Wednesday 12 August 2015

Difference between executefunc() and executeordelayuntilscriptloaded()?

Difference between 
executefunc() and executeordelayuntilscriptloaded()?

Execute func:


ExecuteOrDelayUntilScriptLoaded
  • this is only works with scripts which are loaded by default on the page (OnDemand=False).
  • Its sole purpose is to make sure that the function is called only after the script has completed loading. 


SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () { console.log("Initiating SP.ClientContext") });
ExecuteOrDelayUntilScriptLoaded:
SP.SOD.executeOrDelayUntilScriptLoaded(someFunction,"sp.js");
executeFunc
  • works with scripts which are not loaded on the page by default (OnDemand=True). 
  • Its job is to load the mentioned script on the page and then call the function.

No comments:

Post a Comment