Files: bd411fd1d719442e7658db49d6b8c5d22b10fb25 / main / html / app.js
838 bytesRaw
1 | const { Value, h } = require('mutant') |
2 | const nest = require('depnest') |
3 | const insertCss = require('insert-css') |
4 | |
5 | exports.gives = nest('main.html.app') |
6 | |
7 | exports.needs = nest({ |
8 | 'router.html.page': 'first', |
9 | 'styles.css': 'reduce' |
10 | }) |
11 | |
12 | exports.create = function (api) { |
13 | return nest('main.html.app', app) |
14 | |
15 | function app () { |
16 | const css = values(api.styles.css()).join('\n') |
17 | insertCss(css) |
18 | |
19 | // var view = Value(getView()) |
20 | var view = 'hello!' |
21 | var screen = h('App', view) |
22 | |
23 | // window.onhashchange = () => view.set(getView()) |
24 | // document.body.appendChild(screen) |
25 | |
26 | return screen |
27 | } |
28 | |
29 | // function getView () { |
30 | // const view = window.location.hash.substring(1) || 'tabs' |
31 | // return api.page(view) |
32 | // } |
33 | } |
34 | |
35 | function values (object) { |
36 | const keys = Object.keys(object) |
37 | return keys.map(k => object[k]) |
38 | } |
39 | |
40 |
Built with git-ssb-web