forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.ts
More file actions
27 lines (21 loc) · 682 Bytes
/
helpers.ts
File metadata and controls
27 lines (21 loc) · 682 Bytes
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
import { Context } from './'
export function getAppsFromStorage({ storage }: Context) {
return storage.get('apps')
}
export function getCurrentPortFromStorage({ storage }: Context) {
return storage.get('currentPort')
}
export function getNewPortFromState({ state }: Context) {
return state.newPortValue
}
export function storeApps({ storage, state }: Context) {
storage.set('apps', state.apps)
}
export function toNumber(_, value: string) {
return String(Number(value))
}
export function connectCurrentPort(action: (message: any) => void) {
return function connectCurrentPort({ state, connector }: Context) {
connector.addPort(state.currentPort, action)
}
}