git ssb

16+

Dominic / patchbay



Tree: d1e8d32373cb38ce057fe5f2be8930da57018faa

Files: d1e8d32373cb38ce057fe5f2be8930da57018faa / modules_core / app.js

949 bytesRaw
1var plugs = require('../plugs')
2var h = require('hyperscript')
3
4var screen_view = plugs.first(exports.screen_view = [])
5
6
7exports.app = function () {
8 document.head.appendChild(h('style', require('../style.css.json')))
9
10 window.addEventListener('error', window.onError = function (e) {
11 document.body.appendChild(h('div.error',
12 h('h1', e.message),
13 h('big', h('code', e.filename + ':' + e.lineno)),
14 h('pre', e.error ? (e.error.stack || e.error.toString()) : e.toString())))
15 })
16
17 function hash() {
18 return window.location.hash.substring(1)
19 }
20
21 var view = screen_view(hash() || 'tabs')
22
23 var screen = h('div.screen.column', view)
24
25 window.onhashchange = function (ev) {
26 var _view = view
27 view = screen_view(hash() || 'tabs')
28
29 if(_view) screen.replaceChild(view, _view)
30 else document.body.appendChild(view)
31 }
32
33 document.body.appendChild(screen)
34
35 return screen
36
37}
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

Built with git-ssb-web