-// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
*
* @returns {function} The constructor for the resulting module.
*/
- function Module(name) {
- let args = Array.slice(arguments);
+ function Module(name, ...args) {
var base = ModuleBase;
- if (callable(args[1]))
- base = args.splice(1, 1)[0];
+ if (callable(args[0]))
+ base = args.shift();
- let [, prototype, classProperties, moduleInit] = args;
+ let [prototype, classProperties, moduleInit] = args;
prototype._metaInit_ = function () {
delete module.prototype._metaInit_;
Class.replaceProperty(modules, module.className, this);
const create = window.Object.create.bind(window.Object);
-
const BASES = [BASE, "resource://dactyl-local-content/"];
jsmodules = Cu.createObjectIn(window);
},
scanModules: function scanModules() {
- let self = this;
let { Module, modules } = this.modules;
- defineModule.modules.forEach(function defModule(mod) {
+ defineModule.modules.forEach((mod) => {
let names = Set(Object.keys(mod.INIT));
if ("init" in mod.INIT)
Set.add(names, "init");
- keys(names).forEach(function (name) { self.deferInit(name, mod.INIT, mod); });
+ keys(names).forEach((name) => { this.deferInit(name, mod.INIT, mod); });
});
- Module.list.forEach(function frobModule(mod) {
+ Module.list.forEach((mod) => {
if (!mod.frobbed) {
- modules.__defineGetter__(mod.className, function () {
+ modules.__defineGetter__(mod.className, () => {
delete modules[mod.className];
- return self.loadModule(mod.className, null, Components.stack.caller);
+ return this.loadModule(mod.className, null, Components.stack.caller);
});
Object.keys(mod.prototype.INIT)
- .forEach(function (name) { self.deferInit(name, mod.prototype.INIT, mod); });
+ .forEach((name) => { this.deferInit(name, mod.prototype.INIT, mod); });
}
mod.frobbed = true;
});
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript: