5

When using:

<ltng:require scripts="x,y,z" afterScriptsLoaded="{!c.onScriptLoaded}/>

In a pre-release version of Spring '17 with Locker Service enabled, while in the controller method onScriptLoaded, I'm unable to use my external namespace. However, when I debug the included script, I clearly see that window.MyCodeNamepsace and MyCodeNamepsace evaluate to my code at the end of the included script y. Why can't I access it using the onScriptLoaded method?

ps: it works flawlessly without Locker Service ;)

What am I doing wrong?

4
  • To reproduce this issue and investigate, can you provide us an unmanaged package or a git gist of your code? Reference doc to create an unmanaged package developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/… Dec 21, 2016 at 1:12
  • I was able to get errors when I don't use components inheritance. I am not able to share this code freely :(. Dec 22, 2016 at 19:00
  • This is possibly because of a naming conflict. You can isolate the problem by using an elimination logic i.e, load x, y and z one at a time and see which one is actually causing the issue. Dec 28, 2016 at 18:00
  • You can enable debugging for Lightning by doing this: Go to Setup page in your org, search for "Lightning Components", check "Enable Debug Mode" option and Save. It should be much more easier to break on exceptions using chrome developer tools and the error messages will be readable. Dec 28, 2016 at 18:08

1 Answer 1

2

I'm going to assume that you have checked your browser console log for errors :-)

Based on my experience, it's possible that your script is failing silently with LockerService activated. There is probably a method in your script that is behaving differently because of LockerService JS method override. My only recommendation would be to also debug your script and see where your code is failing. It's a tedious process, unfortunately.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .