Files: 314000baff3b2045fe13f8edf6519b9bdd1779d5 / app / sync / goTo.js
522 bytesRaw
1 | const nest = require('depnest') |
2 | |
3 | exports.gives = nest('app.sync.goTo') |
4 | |
5 | exports.needs = nest({ |
6 | 'router.sync.router': 'first' |
7 | }) |
8 | |
9 | exports.create = (api) => { |
10 | return nest('app.sync.goTo', goTo) |
11 | |
12 | function goTo (location) { |
13 | console.log('goTo', location) |
14 | const newView = api.router.sync.router(location) |
15 | |
16 | // TODO (mix) : change once history in place |
17 | const oldView = document.body.firstChild |
18 | oldView |
19 | ? document.body.replaceChild(newView, oldView) |
20 | : document.body.appendChild(newView) |
21 | } |
22 | } |
23 |
Built with git-ssb-web