git ssb

0+

Zach! / music-visions



Tree: 1c61b53a1012292e58ac4a7b2d2f450506a99711

Files: 1c61b53a1012292e58ac4a7b2d2f450506a99711 / index.js

832 bytesRaw
1//Bring in our outdoor modules
2const choo = require('choo')
3const html = require('choo/html')
4
5//Bring in our indoor modules
6const main = require('./views/main')
7const awesome = require('./views/awesome')
8const works = require('./views/works')
9const songbook = require('./views/songbook')
10const dots = require('./dots.json')
11
12//Initialize choo
13const app = choo()
14
15app.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 })
24function changeSong (data) {
25 page = state.dots.find(dot => dot.title == data)
26 awesome(page)
27 }
28})
29
30app.route('/', main)
31app.route('/:title', changeSong)
32app.route('#songbook', songbook)
33app.mount('div')
34
35
36
37
38
39
40

Built with git-ssb-web