Files: 1c61b53a1012292e58ac4a7b2d2f450506a99711 / index.js
832 bytesRaw
1 | //Bring in our outdoor modules |
2 | const choo = require('choo') |
3 | const html = require('choo/html') |
4 | |
5 | //Bring in our indoor modules |
6 | const main = require('./views/main') |
7 | const awesome = require('./views/awesome') |
8 | const works = require('./views/works') |
9 | const songbook = require('./views/songbook') |
10 | const dots = require('./dots.json') |
11 | |
12 | //Initialize choo |
13 | const app = choo() |
14 | |
15 | app.use(function (state, emitter) { |
16 | //initialize state |
17 | state.dots = dots.dots |
18 | |
19 | //display song |
20 | emitter.on('changeSong', function (choice) { |
21 | var song = state.dots.find(dot => dot.title == choice) |
22 | emitter.emit('pushState','/'+song.link) |
23 | }) |
24 | function changeSong (data) { |
25 | page = state.dots.find(dot => dot.title == data) |
26 | awesome(page) |
27 | } |
28 | }) |
29 | |
30 | app.route('/', main) |
31 | app.route('/:title', changeSong) |
32 | app.route('#songbook', songbook) |
33 | app.mount('div') |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 |
Built with git-ssb-web