Last modified by Thomas Mortagne on 2023/10/13

<
From version < 35.1 >
edited by Thomas Mortagne
on 2016/04/04
To version < 36.1 >
edited by Marius Dumitru Florea
on 2016/04/05
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ThomasMortagne
1 +XWiki.mflorea
Content
... ... @@ -96,10 +96,20 @@
96 96  
97 97  = For Developers =
98 98  
99 -== <developer feature N> ==
99 +== Deferred JavaScript Module Dependency Loading ==
100 100  
101 -<description of developer feature N>
101 +You can extend a feature provided by some JavaScript module without knowing where that module is loaded from (by RequireJS) with the following code:
102 102  
103 +{{code language="js"}}
104 +require(['deferred!module'], function(modulePromise) {
105 + modulePromise.done(function(module) {
106 + // Do something with the module, if the module is loaded by someone else.
107 + });
108 +});
109 +{{/code}}
110 +
111 +This basically says to RequireJS: "let me know when this module is loaded by someone else" (someone else being an other script on the same page). You can read more about this on the [[Developer's Guide>>platform:DevGuide.JavaScriptAPI||anchor="HDeferredDependencyLoading"]].
112 +
103 103  == Deprecated and Retired projects ==
104 104  
105 105  <description of deprecated and retired projects>

Get Connected