all files / src/redux/actions/ history.js

65.52% Statements 19/29
20% Branches 2/10
28.57% Functions 2/7
65.52% Lines 19/29
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60                                                                                 
"use strict";
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setHistory = setHistory;
exports.getHistory = getHistory;
exports.push = push;
exports.replace = replace;
exports.go = go;
exports.goBack = goBack;
exports.goForward = goForward;
var history = null;
 
function setHistory(h) {
  history = h;
}
 
function getHistory() {
  return history;
}
 
function push(path, state) {
  Iif (history) {
    history.push(path, state);
  }
}
 
function replace(path, state) {
  Iif (history) {
    history.replace(path, state);
  }
}
 
function go(n) {
  if (history) {
    history.go(n);
  }
}
 
function goBack() {
  if (history) {
    history.goBack();
  }
}
 
function goForward() {
  if (history) {
    history.goForward();
  }
}
 
exports.default = {
  push: push,
  replace: replace,
  go: go,
  goBack: goBack,
  goForward: goForward
};