-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
32 lines (25 loc) · 1.09 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(function() {
// Main entry point that gets included in index.html
// checks for node-webkit before requirejs pipeline.
// CHECKING FOR NODE-WEBKIT...
// solves name-conflict with require statement from requirejs
if (window && window.require) {
console.log("app.js (node-webkit): initializing nw.gui");
var nwgui = require('nw.gui');
window.nwgui = nwgui;
console.log("app.js (node-webkit): storing window");
window.nwWindow = nwgui.Window.get();
console.log("app.js (node-webkit): moving require to requirenw");
window.requirenw = window.require;
delete window.require;
window.requirenw.version = process.versions.node;
delete process.versions.node;
}
// START REQUIRE JS PIPELINE...
console.log("app.js: initializing requirejs main.js");
var script = document.createElement("script");
script.type = "text/javascript";
script.setAttribute("data-main", "scripts/main"); // main entry point requirejs
script.src = "node_modules/requirejs/require.js"; // link to require.js
document.body.appendChild(script);
}()); // immediately executed.