diff options
author | Kris Maglione <kris@vimperator.org> | 2010-09-17 06:15:13 -0400 |
---|---|---|
committer | Kris Maglione <kris@vimperator.org> | 2010-09-17 06:15:13 -0400 |
commit | a5213c3760ddcb308f2e443f3d86e82a08098718 (patch) | |
tree | a940ef335fa3e060d54d18441d666097fd88da4b /common/content/modules.js | |
parent | 8b0d9586b23eb166fafb064e75c4956021d73ca1 (diff) | |
download | pentadactyl-a5213c3760ddcb308f2e443f3d86e82a08098718.tar.gz |
Precompute completion string matching function.
Diffstat (limited to 'common/content/modules.js')
-rw-r--r-- | common/content/modules.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/common/content/modules.js b/common/content/modules.js index 840f87c5..5f9594a4 100644 --- a/common/content/modules.js +++ b/common/content/modules.js @@ -89,8 +89,8 @@ window.addEventListener("load", function onLoad() { const loaded = set(["init"]); function init(module) { - function init(func) - function () func.call(module, dactyl, modules, window); + function init(func, mod) + function () defmodule.time(module.name || module.constructor.name, mod, func, module, dactyl, modules, window); set.add(loaded, module.constructor.name); for (let [mod, func] in Iterator(module.INIT)) { @@ -98,7 +98,7 @@ window.addEventListener("load", function onLoad() { init(func)(); else { deferredInit[mod] = deferredInit[mod] || []; - deferredInit[mod].push(init(func)); + deferredInit[mod].push(init(func, mod)); } } } @@ -121,21 +121,19 @@ window.addEventListener("load", function onLoad() { for (let dep in values(module.requires)) load(Module.constructors[dep], module.name); - dump("Load" + (isstring(prereq) ? " " + prereq + " dependency: " : ": ") + module.name); + defmodule.loadLog.push("Load" + (isstring(prereq) ? " " + prereq + " dependency: " : ": ") + module.name); if (frame && frame.filename) - dump(" from: " + frame.filename + ":" + frame.lineNumber); + defmodule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber); delete modules[module.name]; - modules[module.name] = module(); + modules[module.name] = defmodule.time(module.name, "init", module); init(modules[module.name]); for (let [, fn] in iter(deferredInit[module.name] || [])) fn(); } catch (e) { - dump("Loading " + (module && module.name) + ": " + e); - if (e.stack) - dump(e.stack); + dump("Loading " + (module && module.name) + ": " + e + "\n" + (e.stack || "")); } return modules[module.name]; } |