Tuesday, July 28, 2015

RequireJS Arrives in SharePoint Online Build 16.0.4230.1217 (Or Earlier?)

A JAVASCRIPT MODULE LOADEREver watchful – and talented – guy that he is, my friend Paul Tavares (@paul_tavares) pinged me the other day on Twitter with a question.

Hey. Question. On your O365, did you add RequireJS as a SOD? Noticed it was registered when I looked at the page code the other day.

Paul has a Site Collection in my tenant that we share for R&D and I certainly hadn’t done anything, so we went back and forth on it a bit.

If you do a View Source on a SharePoint Online page, you may well see this line:

<script type="text/javascript">RegisterSod("require.js", "https:\u002f\u002fcdn.sharepointonline.com\u002f16148\u002f_layouts\u002f15\u002f16.0.4230.1217\u002frequire.js");</script>

This tells me that my tenant is on build 16.0.4230.1217. It’s on First Release, so it may be ahead of the build you see in your own tenant.

The net-net of that line is to load RequireJS if it is needed using SharePoint’s SOD (Script On Demand) framework. It’s a little funny to me that this is happening, because RequireJS’s primary purpose in life is to help load script files when they are needed (among other things).

The good thing here is that if you want to use RequireJS in your applications – as I am regularly now – it’s already there for you by default – in SharePoint Online, at least. Paul and I have no idea when it showed up, but it’s a good thing. The Microsofties ought to let us know when they add such a useful library!


by Marc D Anderson via Marc D Anderson's Blog

No comments:

Post a Comment