Commit 9b2a662b authored by Romain Courteaud's avatar Romain Courteaud

Temporary hack to make AMD require(['renderjs']) work.

Thanks to Caleb James DeLisle.

A better fix in this case would be to cleanly allow RenderJS gadget
instanciation to wait for some events (require and any other JS code)
before deciding that a gadget is ready. Currently, RenderJS ready
function is triggered when all JS scripts defined in the HTML page are
loaded. One idea would be to extend the API to allow the gadget to
explicitely trigger the ready callback (but it will block the full
system if one gadget failed to load).
parent 2a83acbd
...@@ -754,6 +754,10 @@ ...@@ -754,6 +754,10 @@
// run on next tick so that if this was pulled in with requirejs,
// rJS.ready() can still be used.
// XXX: doesn't work with require(['renderjs', 'somethingElse'], ...
setTimeout(function () {
$(document).ready(function () { $(document).ready(function () {
// XXX HTML properties can only be set when the DOM is fully loaded // XXX HTML properties can only be set when the DOM is fully loaded
var settings = renderJS.parseGadgetHTML($('html')[0].outerHTML), var settings = renderJS.parseGadgetHTML($('html')[0].outerHTML),
...@@ -784,6 +788,7 @@ ...@@ -784,6 +788,7 @@
arguments); arguments);
}); });
}); });
});
} }
bootstrap(); bootstrap();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment