Files: 896d9cb98b2e5f5c21d03292502be08b22a16f1a / modules / app.js
639 bytesRaw
1 | var plugs = require('../plugs') |
2 | var h = require('hyperscript') |
3 | |
4 | var screen_view = plugs.first(exports.screen_view = []) |
5 | |
6 | var status = h('div.status') |
7 | |
8 | exports.connection_status = function (err) { |
9 | if(err) status.classList.add('error') |
10 | else status.classList.remove('error') |
11 | } |
12 | |
13 | exports.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 | screen.replaceChild(view = screen_view(hash()), _view) |
25 | } |
26 | |
27 | return screen |
28 | |
29 | } |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 |
Built with git-ssb-web