Skip to content

Conversation

@marco-faustinelli
Copy link
Collaborator

Using pull requests once more for giving you a status report. Please bear with me and DO NOT merge :-)

The good news is that I am able to compile both the Google demo and the master of this project of yours.

This time my spike is about the AsYouTypeFormatter(**). I have modified your libphonenumber.js to include the preparation of a simple member function asYouTypeFormatter(countryCode).

The sample is built around html/loader.html - the task is to read the first input char-by-char and put in the second input the real-time formatted stuff.

It all works fine in compiling and creating the function, but the created AYTF objects are obfuscated. Since I need to use the inputDigit function in my sample, as it is done inside the official demo script, I see two alternative roads ahead:

  • create the asYouTypeFormatter as a separated, full-fledged object with all the methods contained in its original source code, the same way you created your phoneUtils. This will possibly need a build.xml on its own.
  • hardcode the sole usage of inputDigit inside the produced AYTF by acting somehow on the asYouTypeFormatter function

The second path is more hazy in my thoughts, because the product of the asYouTypeFormatter function will have to interact with the DOM elements where the text gets typed by the user. This looks also messy to me, we'll see.

Every comment is welcome.

(**) I have done some good progress also about the preparation of the single-country deliverables, I will update the other PR probably tomorrow.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you've described here is how I imagined we would want it to work:

inputter.addEventListener('input', function(event) {
  outputter.value = aytf.inputDigit(event.value);
});

@nathanhammond
Copy link
Owner

I agree that the first approach you propose would be easier, but I'm not sure what dependencies you would be duplicating if they didn't come out of the same build file. I'd love to see if it's possible to dive in and snag the inputDigit function as describe in your second approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants