function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pedro Garcia 26Pedro Garcia 26 

validate javascript library

Hi...

I'm creating a Lightning component and use the Cytospace javascript library from https://cytoscape.org/
 
<ltng:require scripts="{!join(',', 
                $Resource.cytoscape + '/cytoscape.min.js', 
                $Resource.cytoscape + '/cytoscape.cjs.js')}"
                afterScriptsLoaded="{!c.setup}"/>

I got the following error: Custom Script Eval error in 'ltng:require' [SecureDOMEvent: [object Event] {key: {namespace":"c"}}]

I just follow the SF documentation at https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_libs_platform.htm

How could I validate if the Cytospace library can be used or not in Salesforce?

Thanks
Anil Bolisetty 2Anil Bolisetty 2
could you check whether lightning locker service allows this js .
SwethaSwetha (Salesforce Developers) 
HI Pedro,
The best way to test a javascript library in the locker console is to copy the compiled javascript code file onto the console clicking evaluate (this will trigger locker to run evaluate on the code posted). You can then use the google console to see the error and the locker console will also display the output (including errors).

For more info see https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/security_locker_console_evaluate.htm
 
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you