X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/efe36f4f1b5df351eeb4d40a54c3900cf9a7079b..f87e25a2b4d41deadb65308b278496ad2ff995d3:/src/fnpjs/runner.js?ds=sidebyside diff --git a/src/fnpjs/runner.js b/src/fnpjs/runner.js index 66e0b68..eeef9f9 100644 --- a/src/fnpjs/runner.js +++ b/src/fnpjs/runner.js @@ -1,5 +1,7 @@ define(['libs/jquery', 'libs/underscore'], function($, _) { +'use strict'; + var Runner = function(app, modules) { function getModuleInstance(moduleName) { @@ -10,7 +12,8 @@ var Runner = function(app, modules) { var bootstrappedData = {}, options = {}, moduleInstances = {}, - eventListeners = []; + eventListeners = [], + plugins = []; _.each(_.keys(modules || {}), function(moduleName) { if(_.contains(app.permissions[moduleName] || [], 'handleEvents')) { @@ -33,7 +36,6 @@ var Runner = function(app, modules) { }; this.publish = function(eventName) { - console.log(moduleName + ': ' + eventName); var eventArgs = Array.prototype.slice.call(arguments, 1); _.each(eventListeners, function(listenerModuleName) { var listener = moduleInstances[listenerModuleName]; @@ -52,13 +54,20 @@ var Runner = function(app, modules) { 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({