fixed statics

This commit is contained in:
Márton Molnár
2018-11-05 11:56:30 +01:00
parent 829933ef2f
commit c4d1c52510
4 changed files with 16 additions and 23 deletions
+12 -7
View File
@@ -6,6 +6,11 @@
declare namespace IntlTelInput {
interface Static {
/**
* Default options for all instances
*/
defaults: Options;
/**
* Get all of the plugin's country data - either to re-use elsewhere
* e.g. to populate a country dropdown.
@@ -17,12 +22,6 @@ declare namespace IntlTelInput {
* formatting/validation etc.
*/
loadUtils(path: string, utilsScriptDeferred?: boolean): void;
/**
* initialise the plugin with optional options.
* @param options options that can be provided during initialization.
*/
(node: Element, options?: Options): Plugin;
}
interface Plugin {
@@ -288,5 +287,11 @@ declare namespace intlTelInputUtils {
}
interface Window {
intlTelInput: IntlTelInput.Static;
intlTelInputGlobals: IntlTelInput.Static;
/**
* initialise the plugin with optional options.
* @param options options that can be provided during initialization.
*/
intlTelInput(node: Element, options?: IntlTelInput.Options): IntlTelInput.Plugin;
}
+2 -2
View File
@@ -41,13 +41,13 @@ window.intlTelInput(input).setNumber('+447733123456');
window.intlTelInput(input).setPlaceholderNumberType(intlTelInputUtils.numberType.FIXED_LINE);
const countryData = window.intlTelInput.getCountryData();
const countryData = window.intlTelInputGlobals.getCountryData();
const country = countryData[0];
const dialCode = country.dialCode;
const iso2 = country.iso2;
const countryName = country.name;
window.intlTelInput.loadUtils('build/js/utils.js');
window.intlTelInputGlobals.loadUtils('build/js/utils.js');
window.intlTelInput(input, {
utilsScript: '../../build/js/utils.js'
+2 -2
View File
@@ -42,13 +42,13 @@ $('#phone').intlTelInput('setNumber', '+447733123456');
$('#phone').intlTelInput('setPlaceholderNumberType', intlTelInputUtils.numberType.FIXED_LINE);
const jqueryCountryData = $.fn.intlTelInput.getCountryData();
const jqueryCountryData = window.intlTelInputGlobals.getCountryData();
const jqueryCountry = countryData[0];
const jqueryDialCode = country.dialCode;
const jqueryIso2 = country.iso2;
const jqueryName = country.name;
$.fn.intlTelInput.loadUtils('build/js/utils.js');
window.intlTelInputGlobals.loadUtils('build/js/utils.js');
$('#phone').intlTelInput({
utilsScript: '../../build/js/utils.js'
-12
View File
@@ -4,18 +4,6 @@
declare namespace IntlTelInput {
interface JQueryPlugin {
/**
* Get all of the plugin's country data - either to re-use elsewhere
* e.g. to populate a country dropdown.
*/
getCountryData(): intlTelInputUtils.CountryData[];
/**
* Load the utils.js script (included in the lib directory) to enable
* formatting/validation etc.
*/
loadUtils(path: string, utilsScriptDeferred?: boolean): void;
/**
* initialise the plugin with optional options.
* @param options options that can be provided during initialization.