jackocnr / intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers. React and Vue components also included.
https://intl-tel-input.com
MIT License
7.69k stars 1.95k forks source link

Allow promise-like objects as loadUtilsOnInit option #1878

Open MarcoGlauser opened 2 days ago

MarcoGlauser commented 2 days ago

Related to https://github.com/jackocnr/intl-tel-input/issues/1877 This solves the issue that angular can't load the utils script because zone.js wraps promises.

The utils loader currently does an instanceof check against the builtin Promise type. This doesn't work with wrapped promises, bluebird promises or other custom promises.

By wrapping the source() result in a Promise.reslove(), instead of the instanceof check, we're making sure that we're working with a promise.

I've added a specific testcase for a custom thenable that works with this patch.