mirror of
https://github.com/moparisthebest/mail
synced 2024-11-22 08:52:15 -05:00
changed sandbox.html to load three js files for require as well
This commit is contained in:
parent
9a8088115f
commit
874e9fd42b
@ -8,7 +8,9 @@
|
||||
<link rel="stylesheet" href="css/styles.css"/>
|
||||
|
||||
<!-- The Scripts -->
|
||||
<script data-main="sandbox.js" src="lib/require.js"></script>
|
||||
<script src="lib/require.js"></script>
|
||||
<script src="require-config.js"></script>
|
||||
<script src="sandbox.js"></script>
|
||||
</head>
|
||||
|
||||
<body></body>
|
||||
|
@ -1,54 +1,50 @@
|
||||
require(['require-config'], function() {
|
||||
require(['jquery', 'backbone', 'js/app-router',
|
||||
'js/app-config'
|
||||
], function($, Backbone, Router, app) {
|
||||
'use strict';
|
||||
|
||||
// Start the main app logic.
|
||||
require(['jquery', 'backbone', 'js/app-router',
|
||||
'js/app-config'
|
||||
], function($, Backbone, Router, app) {
|
||||
var router,
|
||||
mainWindow,
|
||||
mainWindowOrigin;
|
||||
|
||||
var router,
|
||||
mainWindow,
|
||||
mainWindowOrigin;
|
||||
/**
|
||||
* Load templates and start the application
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
console.log('sandbox loaded');
|
||||
|
||||
/**
|
||||
* Load templates and start the application
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
console.log('sandbox loaded');
|
||||
// set listener for event from main window
|
||||
window.onmessage = function(e) {
|
||||
if (e.data.cmd === 'init') {
|
||||
app.util.tpl.templates = e.data.args;
|
||||
|
||||
// set listener for event from main window
|
||||
window.onmessage = function(e) {
|
||||
if (e.data.cmd === 'init') {
|
||||
app.util.tpl.templates = e.data.args;
|
||||
// remember references to main window
|
||||
mainWindow = e.source;
|
||||
mainWindowOrigin = e.origin;
|
||||
|
||||
// remember references to main window
|
||||
mainWindow = e.source;
|
||||
mainWindowOrigin = e.origin;
|
||||
// start backone.js router
|
||||
router = new Router();
|
||||
Backbone.history.start();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// start backone.js router
|
||||
router = new Router();
|
||||
Backbone.history.start();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Helper method to ease message posting between sandbox and main window
|
||||
*/
|
||||
app.util.postMessage = function(cmd, args, callback) {
|
||||
// set listender
|
||||
window.onmessage = function(e) {
|
||||
if (e.data.cmd === cmd) {
|
||||
callback(e.data.args);
|
||||
}
|
||||
};
|
||||
|
||||
// send message to main window
|
||||
mainWindow.postMessage({
|
||||
cmd: cmd,
|
||||
args: args
|
||||
}, mainWindowOrigin);
|
||||
/**
|
||||
* Helper method to ease message posting between sandbox and main window
|
||||
*/
|
||||
app.util.postMessage = function(cmd, args, callback) {
|
||||
// set listender
|
||||
window.onmessage = function(e) {
|
||||
if (e.data.cmd === cmd) {
|
||||
callback(e.data.args);
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
// send message to main window
|
||||
mainWindow.postMessage({
|
||||
cmd: cmd,
|
||||
args: args
|
||||
}, mainWindowOrigin);
|
||||
};
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user