git ssb

2+

mixmix / ticktack



Tree: f98c407e53e9a0b812757db574e4a35fcff143d4

Files: f98c407e53e9a0b812757db574e4a35fcff143d4 / app / html / app.js

1209 bytesRaw
1const nest = require('depnest')
2const values = require('lodash/values')
3const insertCss = require('insert-css')
4const openExternal = require('open-external')
5
6const HyperNav = require('hyper-nav')
7const computed = require('mutant/computed')
8const h = require('mutant/h')
9
10exports.gives = nest({
11 'app.html.app': true,
12 'history.obs.location': true,
13 'history.sync.push': true,
14 'history.sync.back': true,
15})
16
17exports.needs = nest({
18 'app.html.header': 'first',
19 'app.async.catchLinkClick': 'first',
20 'router.sync.router': 'first',
21 'styles.css': 'reduce'
22})
23
24exports.create = (api) => {
25 var nav = null
26
27 return nest({
28 'app.html.app': function app () {
29 const css = values(api.styles.css()).join('\n')
30 insertCss(css)
31
32 api.app.async.catchLinkClick(document.body, (link, { isExternal }) => {
33 if (isExternal) return openExternal(link)
34 nav.push(link)
35 })
36
37 nav = HyperNav(
38 api.router.sync.router,
39 api.app.html.header
40 )
41
42 nav.push({page: 'home'})
43 return nav
44 },
45 'history.sync.push': (location) => nav.push(location),
46 'history.sync.back': () => nav.back(),
47 'history.obs.location': () => nav.history,
48 })
49}
50
51
52
53

Built with git-ssb-web