-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (32 loc) · 1.01 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
var css = require("sheetify");
var choo = require("choo");
var store = require("./stores/lights");
css("tachyons");
css("./css/normalize.css");
css("./css/container.css");
css("./css/tree.css");
css("./css/white-decoration.css");
css("./css/ornaments.css");
var app = choo();
if (process.env.NODE_ENV !== "production") {
app.use(require("choo-devtools")());
} else {
// Enable once you want service workers support. At the moment you'll
// need to insert the file names yourself & bump the dep version by hand.
// app.use(require('choo-service-worker')())
}
app.use(store);
app.use(require("choo-audio")());
app.use(loadSounds);
app.route("/", require("./views/main"));
app.route("/*", require("./views/404"));
if (!module.parent) app.mount("body");
else module.exports = app;
function loadSounds(state, emitter, app) {
emitter.on("DOMContentLoaded", function() {
emitter.emit("audio:load", "assets/jingle_bell.wav");
emitter.on("audio:load-complete", function() {
emitter.emit("audio:play");
});
});
}