Files: fc3e260ccddde1d03355b6f48b13702bd807d9ca / modules / app.js
560 bytesRaw
1 | var plugs = require('../plugs') |
2 | var h = require('hyperscript') |
3 | |
4 | var screen_view = plugs.first(exports.screen_view = []) |
5 | |
6 | |
7 | exports.app = function () { |
8 | function hash() { |
9 | return window.location.hash.substring(1) |
10 | } |
11 | |
12 | var view = screen_view(hash() || 'tabs') |
13 | |
14 | var screen = h('div.screen.column', view) |
15 | |
16 | window.onhashchange = function (ev) { |
17 | var _view = view |
18 | view = screen_view(hash() || 'tabs') |
19 | |
20 | if(_view) screen.replaceChild(view, _view) |
21 | else document.body.appendChild(view) |
22 | } |
23 | |
24 | |
25 | return screen |
26 | |
27 | } |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 | |
57 | |
58 |
Built with git-ssb-web