2013-06-10 21:14:57 -04:00
|
|
|
require(['require-config'], function() {
|
2013-06-06 09:00:51 -04:00
|
|
|
'use strict';
|
|
|
|
|
2013-06-10 21:14:57 -04:00
|
|
|
// Start the main app logic.
|
|
|
|
require(['jquery', 'backbone', 'js/app-controller', 'js/app-router',
|
|
|
|
'js/app-config'
|
|
|
|
], function($, Backbone, controller, Router, app) {
|
2013-06-06 09:00:51 -04:00
|
|
|
|
2013-06-10 21:14:57 -04:00
|
|
|
var router;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load templates and start the application
|
|
|
|
*/
|
|
|
|
$(document).ready(function() {
|
|
|
|
controller.init(function() {
|
|
|
|
controller.start(startApp);
|
|
|
|
});
|
2013-06-06 09:00:51 -04:00
|
|
|
});
|
|
|
|
|
2013-06-10 21:14:57 -04:00
|
|
|
function startApp() {
|
|
|
|
// start backone.js router
|
|
|
|
router = new Router();
|
|
|
|
Backbone.history.start();
|
|
|
|
}
|
2013-06-06 09:00:51 -04:00
|
|
|
|
2013-06-10 21:14:57 -04:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
};
|
2013-06-06 09:00:51 -04:00
|
|
|
|
2013-06-10 21:14:57 -04:00
|
|
|
});
|
|
|
|
});
|