diff --git a/src/index.html b/src/index.html index 67583fa..12b2041 100755 --- a/src/index.html +++ b/src/index.html @@ -8,7 +8,9 @@ - + + + diff --git a/src/index.js b/src/index.js index 61ebb98..5a0f473 100644 --- a/src/index.js +++ b/src/index.js @@ -1,43 +1,39 @@ -require(['require-config'], function() { +require(['jquery', 'js/app-controller', 'js/app-config'], function($, controller, app) { 'use strict'; - // Start the main app logic. - require(['jquery', 'js/app-controller', 'js/app-config'], function($, controller, app) { - - /** - * Load templates and start the application - */ - $(document).ready(function() { - controller.init(function() { - controller.start(startApp); - }); + /** + * Load templates and start the application + */ + $(document).ready(function() { + controller.init(function() { + controller.start(startApp); }); - - function startApp() { - // sandboxed ui in iframe - var sandbox = document.getElementById('sandboxFrame').contentWindow; - - // set global listener for events from sandbox - window.onmessage = function(e) { - var cmd = e.data.cmd; - var args = e.data.args; - - // handle the workload in the main window - controller.execute(cmd, args, function(resArgs) { - // send reponse to sandbox - sandbox.postMessage({ - cmd: cmd, - args: resArgs - }, '*'); - }); - }; - - // init sandbox ui - sandbox.postMessage({ - cmd: 'init', - args: app.util.tpl.templates - }, '*'); - } - }); + + function startApp() { + // sandboxed ui in iframe + var sandbox = document.getElementById('sandboxFrame').contentWindow; + + // set global listener for events from sandbox + window.onmessage = function(e) { + var cmd = e.data.cmd; + var args = e.data.args; + + // handle the workload in the main window + controller.execute(cmd, args, function(resArgs) { + // send reponse to sandbox + sandbox.postMessage({ + cmd: cmd, + args: resArgs + }, '*'); + }); + }; + + // init sandbox ui + sandbox.postMessage({ + cmd: 'init', + args: app.util.tpl.templates + }, '*'); + } + }); \ No newline at end of file diff --git a/src/mobile.html b/src/mobile.html index 68ed8ed..816ba05 100644 --- a/src/mobile.html +++ b/src/mobile.html @@ -8,7 +8,9 @@ - + + + diff --git a/src/mobile.js b/src/mobile.js index b94ce08..48995fb 100644 --- a/src/mobile.js +++ b/src/mobile.js @@ -1,35 +1,31 @@ -require(['require-config'], function() { +require(['jquery', 'backbone', 'js/app-controller', 'js/app-router', + 'js/app-config' +], function($, Backbone, controller, Router, app) { 'use strict'; - // Start the main app logic. - require(['jquery', 'backbone', 'js/app-controller', 'js/app-router', - 'js/app-config' - ], function($, Backbone, controller, Router, app) { + var router; - var router; - - /** - * Load templates and start the application - */ - $(document).ready(function() { - controller.init(function() { - controller.start(startApp); - }); + /** + * Load templates and start the application + */ + $(document).ready(function() { + controller.init(function() { + controller.start(startApp); }); - - function startApp() { - // start backone.js router - router = new Router(); - Backbone.history.start(); - } - - /** - * Helper method shim to ease message posting between sandbox and main window - */ - app.util.postMessage = function(cmd, args, callback) { - // handle the workload in the main window - controller.execute(cmd, args, callback); - }; - }); + + function startApp() { + // start backone.js router + router = new Router(); + Backbone.history.start(); + } + + /** + * Helper method shim to ease message posting between sandbox and main window + */ + app.util.postMessage = function(cmd, args, callback) { + // handle the workload in the main window + controller.execute(cmd, args, callback); + }; + }); \ No newline at end of file