summaryrefslogtreecommitdiff
path: root/common/modules/overlay.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'common/modules/overlay.jsm')
-rw-r--r--common/modules/overlay.jsm42
1 files changed, 33 insertions, 9 deletions
diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm
index d9165085..e7dd2afe 100644
--- a/common/modules/overlay.jsm
+++ b/common/modules/overlay.jsm
@@ -246,9 +246,11 @@ var Overlay = Module("Overlay", {
defineModule.loadLog.push(" from: " + util.fixURI(frame.filename) + ":" + frame.lineNumber);
delete modules[module.className];
+ // util.dump("INIT: " + module.className);
modules[module.className] = defineModule.time(module.className, "init", module);
+ frob(module.className);
- init(modules[module.className]);
+ // init(modules[module.className]);
}
catch (e) {
util.dump("Loading " + (module && module.className) + ":");
@@ -257,16 +259,38 @@ var Overlay = Module("Overlay", {
return modules[module.className];
}
- for each (let module in defineModule.modules)
- if (module.INIT.init)
- defineModule.time(module.constructor.className, "init",
- module.INIT.init, module,
- modules.dactyl, modules, window);
+ Module.list.forEach(function (mod) {
+ Object.keys(mod.prototype.INIT).forEach(function (name) {
+ deferredInit[name] = deferredInit[name] || [];
+ deferredInit[name].push(function () {
+ // util.dump("INIT: " + mod.className + ":" + name);
+ defineModule.time(mod.className, name,
+ name, mod.prototype.INIT,
+ modules.dactyl, modules, window);
+ });
+ });
+ });
+ defineModule.modules.forEach(function (mod) {
+ Object.keys(mod.INIT).forEach(function (name) {
+ deferredInit[name] = deferredInit[name] || [];
+ deferredInit[name].push(function () {
+ // util.dump("INIT: " + mod.constructor.className + ":" + name);
+ defineModule.time(mod.constructor.className, name,
+ mod.INIT[name], mod,
+ modules.dactyl, modules, window);
+ });
+ });
+ });
+
+ function frob(name) {
+ (deferredInit[name] || []).forEach(call);
+ }
- defineModule.modules.map(init);
+ frob("init");
+ defineModule.modules.forEach(function (mod) { frob(mod.className); });
- Module.list.forEach(load);
- deferredInit["load"].forEach(call);
+ // Module.list.forEach(load);
+ frob("load");
modules.times = update({}, defineModule.times);
defineModule.loadLog.push("Loaded in " + (Date.now() - start) + "ms");