git ssb

16+

Dominic / patchbay



Tree: 7e6b652a5696469876bec17b9d29a4e649627d76

Files: 7e6b652a5696469876bec17b9d29a4e649627d76 / modules / app.js

748 bytesRaw
1var plugs = require('../plugs')
2var h = require('hyperscript')
3
4var screen_view = plugs.first(exports.screen_view = [])
5
6var status = h('div.status.error') //start off disconnected
7
8exports.connection_status = function (err) {
9 if(err) status.classList.add('error')
10 else status.classList.remove('error')
11}
12
13exports.app = function () {
14 function hash() {
15 return window.location.hash.substring(1)
16 }
17
18 var view = screen_view(hash() || 'tabs')
19
20 var screen = h('div.screen.column', status, view)
21
22 window.onhashchange = function (ev) {
23 var _view = view
24 view = screen_view(hash() || 'tabs')
25
26 if(_view) screen.replaceChild(view, _view)
27 else document.body.appendChild(view)
28 }
29
30 return screen
31
32}
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

Built with git-ssb-web