I'm using Google closure online compiler for libphonenumber. Here is the compiler code:
// ==ClosureCompiler==
// @output_file_name default.js
// @compilation_level SIMPLE_OPTIMIZATIONS
// @use_closure_library true
// @code_url http://libphonenumber.googlecode.com/svn/trunk/javascript/i18n/phonenumbers/phonemetadata.pb.js
// @code_url http://libphonenumber.googlecode.com/svn/trunk/javascript/i18n/phonenumbers/phonenumber.pb.js
// @code_url http://libphonenumber.googlecode.com/svn/trunk/javascript/i18n/phonenumbers/metadatalite.js
// @code_url http://libphonenumber.googlecode.com/svn/trunk/javascript/i18n/phonenumbers/phonenumberutil.js
// @code_url http://libphonenumber.googlecode.com/svn/trunk/javascript/i18n/phonenumbers/asyoutypeformatter.js
// ==/ClosureCompiler==
This compiles successfully, but when i include compiled js file in html then it gives error: undefined is not a function, line 196
I suspect it have something to do with goog.require('goog.proto2.Message');, but no luck so far.
Final goal is to make phone number validation, something like this:
var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
var number = phoneUtil.parseAndKeepRawInput('1234567899', 'XX');
var isNumberValid = phoneUtil.isValidNumber(number);
How to solve TypeError: goog.proto2.Message.set$Metadata is not a function?
The set$Metadata
method was removed in this commit: https://github.com/google/closure-library/commit/d49d52de4577aea38dd0d3ec76a931c2f551dbf3