Getting "Uncaught TypeError: Illegal invocation throws at" in salesforce community when using AutoNumeric,js

473 views Asked by At

When i run below js in separate LWC, it works fine. If i try to include this code in another lightning web component it is throwing error as soon as i click on the input box or any button. If i redeploy the previous code then also the error is coming in that particular community. Rest of the communities working fine.

jsInitialized = false;
@track currencyValue = '';

handleCurrencyChange(event) {

    var options = {
        currencySymbol: "$",
        decimalPlaces: 0
    };
    this.currencyValue = AutoNumeric.format(event.target.value, options);
}

renderedCallback() {
    if (this.jsInitialized) {
        return;
    }
    this.jsInitialized = true;

    Promise.all([
        loadScript(this, libs + '/libs/autonumeric.min.js'),
        loadScript(this, libs + '/libs/libphonenumber-max.js')
    ])
        .then(() => {

        })
        .catch(error => {
            this.dispatchEvent(
                new ShowToastEvent({
                    title: 'Error loading Scripts',
                    message: error.message,
                    variant: 'error'
                })
            );
        });
}
0

There are 0 answers