All files / src actions.js

56.25% Statements 9/16
100% Branches 0/0
18.18% Functions 2/11
60% Lines 9/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 32 33 34 35  1x   1x                 5x 2x   1x 1x 1x     1x       1x                    
 
import { getHistory } from './history'
 
export const actions = {
  push: '@navigator:push',
  pop: '@navigator:pop',
  init: '@navigator:init',
 
  // @TODO
  replace: '@navigator:replace'
}
 
export const dispatcher = (signal, type) =>
  payload => signal.emit({ type, payload })
 
export const back = () => getHistory().goBack()
export const forward = () => getHistory().goForward()
export const push = function () {
  return getHistory().push(...arguments)
}
export const go = function () {
  return getHistory().go(...arguments)
}
 
export const createActions = history => ({
  back: () => getHistory(history).goBack(),
  forward: () => getHistory(history).goForward(),
  push: function () {
    return getHistory(history).push(...arguments)
  },
  go: function () {
    return getHistory(history).go(...arguments)
  }
})