Commit 00db435a authored by Sebastian's avatar Sebastian

modified renderjs.js, tests soon

parent b3ca6f36
...@@ -132,7 +132,8 @@ ...@@ -132,7 +132,8 @@
scope_increment = 0, scope_increment = 0,
isAbsoluteOrDataURL = new RegExp('^(?:[a-z]+:)?//|data:', 'i'), isAbsoluteOrDataURL = new RegExp('^(?:[a-z]+:)?//|data:', 'i'),
is_page_unloaded = false, is_page_unloaded = false,
error_list = []; error_list = [],
bootstrap_deferred_object = new RSVP.defer();
window.addEventListener('error', function (error) { window.addEventListener('error', function (error) {
error_list.push(error); error_list.push(error);
...@@ -1286,6 +1287,16 @@ ...@@ -1286,6 +1287,16 @@
// Bootstrap process. Register the self gadget. // Bootstrap process. Register the self gadget.
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// Manually initializes the self gadget if the DOMContentLoaded event
// is triggered before everything was ready.
// (For instance, the HTML-tag for the self gadget gets inserted after
// page load)
renderJS.manualBootstrap = function () {
bootstrap_deferred_object.resolve();
};
function bootstrap() { function bootstrap() {
var url = removeHash(window.location.href), var url = removeHash(window.location.href),
TmpConstructor, TmpConstructor,
...@@ -1598,7 +1609,16 @@ ...@@ -1598,7 +1609,16 @@
throw e; throw e;
}); });
} }
document.addEventListener('DOMContentLoaded', init, false); document.addEventListener('DOMContentLoaded',
bootstrap_deferred_object.resolve, false);
// Return Promies/Queue here instead of directly calling init()
return new RSVP.Queue()
.push(function () {
return bootstrap_deferred_object.promise;
})
.push(function () {
return init();
});
}); });
loading_gadget_promise loading_gadget_promise
......
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