Browse Source

refactor main, app

Nils Schneider 9 years ago
parent
commit
3a501766ff
3 changed files with 8 additions and 6 deletions
  1. 4 0
      app.js
  2. 1 1
      build.js
  3. 3 5
      lib/main.js

+ 4 - 0
app.js

@@ -18,3 +18,7 @@ require.config({
     "helper": []
   }
 })
+
+require(["main", "helper"], function (main) {
+  main()
+})

+ 1 - 1
build.js

@@ -2,7 +2,7 @@
     baseUrl: "lib",
     name: "../bower_components/almond/almond",
     mainConfigFile: "app.js",
-    include: "main",
+    include: "../app",
     wrap: true,
     optimize: "uglify",
     out: "app-combined.js"

+ 3 - 5
lib/main.js

@@ -1,8 +1,6 @@
-require(["config", "moment", "chroma-js", "router", "map", "sidebar", "tabs", "container", "meshstats", "linklist", "nodelist", "simplenodelist", "infobox/main", "helper"],
-function (Config, moment, chroma, Router, Map, Sidebar, Tabs, Container, Meshstats, Linklist, Nodelist, SimpleNodelist, Infobox) {
-  main(Config)
-
-  function main(config) {
+define(["config", "moment", "chroma-js", "router", "map", "sidebar", "tabs", "container", "meshstats", "linklist", "nodelist", "simplenodelist", "infobox/main"],
+function (config, moment, chroma, Router, Map, Sidebar, Tabs, Container, Meshstats, Linklist, Nodelist, SimpleNodelist, Infobox) {
+  return function () {
     var linklist, lostnodeslist, map, meshstats, newnodeslist, nodelist, router
 
     function createGUI() {