-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (33 loc) · 1.16 KB
/
index.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
33
34
35
36
37
38
39
40
41
var assets = require('./assets/*.png');
var sounds = require('./assets/*.wav');
var less = require('./src/main.less');
var Main = require('./output/Game');
function main () {
/*
Here we could add variables such as
var baseUrl = process.env.BASE_URL;
Parcel will replace `process.env.BASE_URL`
with the string contents of the BASE_URL environment
variable at bundle/build time.
A .env file can also be used to override shell variables
for more information, see https://en.parceljs.org/env.html
These variables can be supplied to the Main.main function.
However, you will need to change the type to accept variables, by default it is an Effect.
You will probably want to make it a function from String -> Effect ()
*/
window.assets = Object.assign(assets, sounds);
window.addEventListener('popstate', function(event) {
window.location.reload();
});
Main.main();
}
// HMR setup. For more info see: https://parceljs.org/hmr.html
if (module.hot) {
module.hot.accept(function () {
console.log('Reloaded, running main again');
document.body.innerHTML = '';
main();
});
}
console.log('Starting app');
main();