define(['libs/jquery', 'libs/underscore'], function($, _) {
+'use strict';
+
var Runner = function(app, modules) {
function getModuleInstance(moduleName) {
var bootstrappedData = {},
options = {},
moduleInstances = {},
- eventListeners = [];
+ eventListeners = [],
+ plugins = [];
_.each(_.keys(modules || {}), function(moduleName) {
if(_.contains(app.permissions[moduleName] || [], 'handleEvents')) {
};
this.publish = function(eventName) {
- console.log(moduleName + ': ' + eventName);
var eventArgs = Array.prototype.slice.call(arguments, 1);
_.each(eventListeners, function(listenerModuleName) {
var listener = moduleInstances[listenerModuleName];
this.getDOM = _.contains(permissions, 'getDOM') ? function() {
return $(options.rootSelector);
} : undefined;
-
+
+ this.getPlugins = function() {
+ return plugins;
+ };
};
this.setBootstrappedData = function(moduleName, data) {
bootstrappedData[moduleName] = data;
};
+
+ this.registerPlugin = function(plugin) {
+ plugins.push(plugin);
+ };
this.start = function(_options) {
options = _.extend({