Skip to content

Commit

Permalink
Change _ prefix to private for all attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jovan Milosevic authored and vscav committed Nov 2, 2023
1 parent d1d1bf0 commit dd44bcc
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ember-phone-input/src/components/phone-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,29 +235,29 @@ export default class PhoneInputComponent extends Component<PhoneInputSignature>
this.intlTelInputInstance?.getNumber() ??
(event?.target as HTMLInputElement).value;

const meta = this._metaData(this.intlTelInputInstance);
const meta = this.metaData(this.intlTelInputInstance);
this.update(internationalPhoneNumber, meta);

return true;
}

@action
onDidUpdate(): void {
this._formatNumber();
this.formatNumber();
}

@action
onDidInsert(element: HTMLInputElement): void {
this._loadAndSetup(element);
this.loadAndSetup(element);
}

@action
onDestroy(element: HTMLInputElement): void {
this.intlTelInputInstance?.destroy();
element.removeEventListener('countrychange', this._onCountryChange);
element.removeEventListener('countrychange', this.onCountryChange);
}

async _loadAndSetup(element: HTMLInputElement): Promise<void> {
private async loadAndSetup(element: HTMLInputElement): Promise<void> {
try {
this.isLoadingIntlTelInput = true;

Expand All @@ -269,13 +269,13 @@ export default class PhoneInputComponent extends Component<PhoneInputSignature>
return;
}

this._setupLibrary(element);
this.setupLibrary(element);

this._formatNumber();
this.formatNumber();

element.addEventListener(
'countrychange',
this._onCountryChange.bind(this)
this.onCountryChange.bind(this)
);
} catch (error) {
this.args.onError?.(error);
Expand All @@ -286,7 +286,7 @@ export default class PhoneInputComponent extends Component<PhoneInputSignature>
}
}

_formatNumber(): void {
private formatNumber(): void {
if (!this.intlTelInputInstance) {
return;
}
Expand All @@ -300,7 +300,7 @@ export default class PhoneInputComponent extends Component<PhoneInputSignature>
}
}

_setupLibrary(element: HTMLInputElement): void {
private setupLibrary(element: HTMLInputElement): void {
if (!this.phoneInput.intlTelInput) {
return;
}
Expand Down Expand Up @@ -342,10 +342,10 @@ export default class PhoneInputComponent extends Component<PhoneInputSignature>
this.intlTelInputInstance.setCountry(this.initialCountry);
}

this.update(this.number, this._metaData(intlTelInputInstance));
this.update(this.number, this.metaData(intlTelInputInstance));
}

_metaData(intlTelInputPlugin: intlTelInput.Plugin | null): MetaData {
private metaData(intlTelInputPlugin: intlTelInput.Plugin | null): MetaData {
if (!intlTelInputPlugin) {
// Libraries may rely on always receiving an object
return {} as MetaData;
Expand Down Expand Up @@ -382,7 +382,7 @@ export default class PhoneInputComponent extends Component<PhoneInputSignature>
};
}

_onCountryChange(): void {
private onCountryChange(): void {
const selectedCountry = this.intlTelInputInstance?.getSelectedCountryData();

if (selectedCountry?.iso2) {
Expand Down

0 comments on commit dd44bcc

Please sign in to comment.