@incdevco/framework
Version:
node.js lambda framework
86 lines (50 loc) • 1.21 kB
JavaScript
function Module(name) {
'use strict';
this.configs = [];
this.constants = {};
this.controllers = {};
this.directives = {};
this.factories = {};
this.filters = {};
this.name = name;
this.runs = [];
}
Module.prototype.config = function (obj) {
'use strict';
this.configs.push(obj);
return this;
};
Module.prototype.constant = function (name, value) {
'use strict';
if (this.constants[name]) {
throw new Error("'" + name + "' constant already set");
}
this.constants[name] = value;
return this;
};
Module.prototype.controller = function (name, obj) {
'use strict';
this.controllers[name] = obj;
return this;
};
Module.prototype.directive = function (name, obj) {
'use strict';
this.directives[name] = obj;
return this;
};
Module.prototype.factory = function (name, obj) {
'use strict';
this.factories[name] = obj;
return this;
};
Module.prototype.filter = function (name, obj) {
'use strict';
this.filters[name] = obj;
return this;
};
Module.prototype.run = function (obj) {
'use strict';
this.runs.push(obj);
return this;
};
module.exports = Module;