3

I'm getting a "sorry to interrupt" error modal when trying a custom component I'm building. The component doesn't even load (the specified action in the afterScriptsLoaded doesn't even run).

The message shows:

Custom Script Eval error [SecureDOMEvent: [object Event]{ key: {"namespace":"ltngtr"} }]

Where "ltngtr" is my org's namespace, of course.

The component's syntax is like this:

<aura:component>
    <ltng:require scripts="{!$Resource.MyCustomLibraryJS}" afterScriptsLoaded="{!c.doInit}"/>

    <aura:attribute name="code" type="String" access="global"/>

    ...

</aura:component>

I've tried adding the namespace to the JS file (like {!$Resource.ltngtr__MyCustomLibraryJS}), and it didn't change the results.

And my .app page is calling it like this:

<aura:application extends="force:slds">
    <ltngtr:MyComponent code="test"/>
</aura:application>

"MyCustomLibraryJS" is a static resource JavaScript file of a custom JS library I'm using.

2

Its looks like an issue with your library. When you encounter errors related to the external libraries the first place to look for is checking your library against Locker console.

As a reference, here are some best practices around for creating custom js libraries with locker service compatibility. Sharing JavaScript Code Across Components

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.