Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Form OnLoad And Availability Of Form Libraries

$
0
0

If I add custom JavaScript that is executed on a form's OnLoad event, and that JavaScript depends on a library that I have added as one that will be available to the form, will that library be available to my custom JavaScript, or could that library still be loading?

I'm looking at "Manage library dependencies" and "Write scripts that perform well" at Write code for Microsoft Dynamics 365 forms. It says:

Avoid loading all scripts in the Onload event
If you have code that only supports OnChange events for fields or the OnSave event, make sure to set the script library with the event handler for those events instead of the OnLoad event. This way loading those libraries can be deferred and increase performance when the form loads.

I was under the impression that a form's OnLoad event only fires once all of the script libraries added to it are also loaded, and so even if those libraries are loaded in parallel, as long as my custom JavaScript doesn't execute anything from them them until OnLoad fires (and they don't execute anything from each other until then), I can count on them to be available.

But that last sentence implies that maybe only libraries that actually have a containing function registered for the form's OnLoad event are guaranteed to be loaded and available at that point. Is that true?


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>