Three Sharepoint Delay Loading Scripts

Common issue I have found with writing javascript in Sharepoint, especially when using JSOM or Client Context, is loading times. Some pages load the sp.js file later than others, not sure of all the in’s and out’s but these are my go to functions.

// Execute code after the script SP.js is loaded

SP.SOD.executeOrDelayUntilScriptLoaded(runthiscode, ‘SP.js’);

// Execute code after SP.js and SP.ClientContext is loaded

SP.SOD.executeFunc(‘sp.js’, ‘SP.ClientContext’, sharePointReady);

//Add my function after all the sharepoint functions run


©Larry Buffaloboy