Cleaning up files structure
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 29 May 2013 07:43:26 +0000 (09:43 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 29 May 2013 07:45:41 +0000 (09:45 +0200)
entrypoint.js
fnpjs/runner.js [new file with mode: 0644]
runner.js [deleted file]

index 70659e9..ac80979 100644 (file)
@@ -19,7 +19,7 @@
     
     requirejs([
         'libs/jquery-1.9.1.min',
     
     requirejs([
         'libs/jquery-1.9.1.min',
-        'runner',
+        'fnpjs/runner',
         'rng',
         './modules',
         'libs/bootstrap/js/bootstrap.min'
         'rng',
         './modules',
         'libs/bootstrap/js/bootstrap.min'
diff --git a/fnpjs/runner.js b/fnpjs/runner.js
new file mode 100644 (file)
index 0000000..8cce7d2
--- /dev/null
@@ -0,0 +1,77 @@
+define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($, _) {\r
+\r
+var Runner = function(app, modules) {\r
+\r
+    function getModuleInstance(moduleName) {\r
+        var module = moduleInstances[moduleName] = (moduleInstances[moduleName] || modules[moduleName](new Sandbox(moduleName)));\r
+        return module;\r
+    }\r
+\r
+    var bootstrappedData = {},\r
+        options = {},\r
+        moduleInstances = {},\r
+        eventListeners = [];\r
+        \r
+    _.each(_.keys(modules || {}), function(moduleName) {\r
+        if(_.contains(app.permissions[moduleName] || [], 'handleEvents')) {\r
+            eventListeners.push(moduleName)\r
+        }\r
+    });\r
+\r
+    \r
+        \r
+    var Sandbox = function(moduleName) {\r
+        this.$ = $;\r
+        this._ = _;\r
+        \r
+        this.getBootstrappedData = function() {\r
+            return bootstrappedData[moduleName];\r
+        }\r
+        \r
+        this.getTemplate = function(templateName) {\r
+            return _.template($('[data-template-name="' + moduleName + '.' + templateName + '"]').html().trim());\r
+        }\r
+        \r
+        this.publish = function(eventName) {\r
+            console.log(moduleName + ': ' + eventName);\r
+            var eventArgs = Array.prototype.slice.call(arguments, 1)\r
+            _.each(eventListeners, function(listenerModuleName) {\r
+                var listener = moduleInstances[listenerModuleName];\r
+                if(listener) {\r
+                    listener.handleEvent(moduleName, eventName, eventArgs);\r
+                }\r
+            });\r
+        }\r
+        \r
+        var permissions = app.permissions[moduleName];\r
+        \r
+        this.getModule = _.contains(permissions, 'getModule') ? function(requestedModuleName) {\r
+            return getModuleInstance(requestedModuleName);\r
+        } : undefined;\r
+        \r
+        this.getDOM = _.contains(permissions, 'getDOM') ? function() {\r
+            return $(options.rootSelector);\r
+        } : undefined;\r
+        \r
+    };\r
+    \r
+    \r
+    this.setBootstrappedData = function(moduleName, data) {\r
+        bootstrappedData[moduleName] = data;\r
+    };\r
+    \r
+    this.start = function(_options) {\r
+        options = _.extend({\r
+            rootSelector: 'body'\r
+        }, _options);\r
+        app.initModules.forEach(function(moduleName) {\r
+            getModuleInstance(moduleName).start();\r
+        });\r
+    }\r
+}\r
+\r
+return {\r
+    Runner: Runner\r
+}\r
+\r
+});
\ No newline at end of file
diff --git a/runner.js b/runner.js
deleted file mode 100644 (file)
index 8cce7d2..0000000
--- a/runner.js
+++ /dev/null
@@ -1,77 +0,0 @@
-define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($, _) {\r
-\r
-var Runner = function(app, modules) {\r
-\r
-    function getModuleInstance(moduleName) {\r
-        var module = moduleInstances[moduleName] = (moduleInstances[moduleName] || modules[moduleName](new Sandbox(moduleName)));\r
-        return module;\r
-    }\r
-\r
-    var bootstrappedData = {},\r
-        options = {},\r
-        moduleInstances = {},\r
-        eventListeners = [];\r
-        \r
-    _.each(_.keys(modules || {}), function(moduleName) {\r
-        if(_.contains(app.permissions[moduleName] || [], 'handleEvents')) {\r
-            eventListeners.push(moduleName)\r
-        }\r
-    });\r
-\r
-    \r
-        \r
-    var Sandbox = function(moduleName) {\r
-        this.$ = $;\r
-        this._ = _;\r
-        \r
-        this.getBootstrappedData = function() {\r
-            return bootstrappedData[moduleName];\r
-        }\r
-        \r
-        this.getTemplate = function(templateName) {\r
-            return _.template($('[data-template-name="' + moduleName + '.' + templateName + '"]').html().trim());\r
-        }\r
-        \r
-        this.publish = function(eventName) {\r
-            console.log(moduleName + ': ' + eventName);\r
-            var eventArgs = Array.prototype.slice.call(arguments, 1)\r
-            _.each(eventListeners, function(listenerModuleName) {\r
-                var listener = moduleInstances[listenerModuleName];\r
-                if(listener) {\r
-                    listener.handleEvent(moduleName, eventName, eventArgs);\r
-                }\r
-            });\r
-        }\r
-        \r
-        var permissions = app.permissions[moduleName];\r
-        \r
-        this.getModule = _.contains(permissions, 'getModule') ? function(requestedModuleName) {\r
-            return getModuleInstance(requestedModuleName);\r
-        } : undefined;\r
-        \r
-        this.getDOM = _.contains(permissions, 'getDOM') ? function() {\r
-            return $(options.rootSelector);\r
-        } : undefined;\r
-        \r
-    };\r
-    \r
-    \r
-    this.setBootstrappedData = function(moduleName, data) {\r
-        bootstrappedData[moduleName] = data;\r
-    };\r
-    \r
-    this.start = function(_options) {\r
-        options = _.extend({\r
-            rootSelector: 'body'\r
-        }, _options);\r
-        app.initModules.forEach(function(moduleName) {\r
-            getModuleInstance(moduleName).start();\r
-        });\r
-    }\r
-}\r
-\r
-return {\r
-    Runner: Runner\r
-}\r
-\r
-});
\ No newline at end of file