-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathnavigate.ls
31 lines (31 loc) · 902 Bytes
/
navigate.ls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require! {
\./browser/window.ls
\./pages.ls
\./seed.ls : { saved }
\./oldseed.ls
\mobx : { transaction }
\./scroll-top.ls
}
get-page = (store, page)->
return page if page isnt \:init
stage2 = store.current.page is \locked or not saved!
store.current.seed = oldseed! if stage2
return \newseed if stage2
\wallets
init-control = (store, name, cb)->
#<- set-timeout _, 1
control = pages[name]
return cb null if typeof! control?init isnt \Function
control.init store, cb
focus-control = (store, name, cb)->
scroll-top!
control = pages[name]
return cb null if typeof! control?focus isnt \Function
control.focus store, cb
module.exports = (store, page)->
scroll-top!
store.current.page = \loading
name = get-page store, page
<- init-control store, name
store.current.page = name
<- focus-control store, name