@shopgate/pwa-common
Version:
Common library for the Shopgate Connect PWA.
35 lines • 2.44 kB
JavaScript
import{NAVIGATE,ROUTE_WILL_ENTER,ROUTE_DID_ENTER,ROUTE_WILL_LEAVE,ROUTE_DID_LEAVE,ROUTE_DID_UPDATE}from"../../constants/ActionTypes";/**
* Creates the dispatched NAVIGATE action object.
* @param {Object} params The history params.
* @param {string} params.action The history action.
* @param {string} params.pathname The history pathname.
* @param {boolean} params.silent Whether or not to navigate silently (no events).
* @param {Object} params.state The history state.
* @param {number} params.steps The number of steps to navigate by.
* @return {Object} The dispatched action object.
*/export var navigate=function navigate(params){return{type:NAVIGATE,params:params};};/**
* Creates the dispatched ROUTE_WILL_ENTER action object.
* @param {Object} route The route object.
* @param {string} historyAction The history action.
* @return {Object} The dispatched action object.
*/export var routeWillEnter=function routeWillEnter(route,historyAction){return{type:ROUTE_WILL_ENTER,route:route,historyAction:historyAction};};/**
* Creates the dispatched ROUTE_DID_ENTER action object.
* @param {Object} route The route object.
* @param {string} historyAction The history action.
* @return {Object} The dispatched action object.
*/export var routeDidEnter=function routeDidEnter(route,historyAction){return{type:ROUTE_DID_ENTER,route:route,historyAction:historyAction};};/**
* Creates the dispatched ROUTE_WILL_LEAVE action object.
* @param {Object} route The route object.
* @param {string} historyAction The history action.
* @return {Object} The dispatched action object.
*/export var routeWillLeave=function routeWillLeave(route,historyAction){return{type:ROUTE_WILL_LEAVE,route:route,historyAction:historyAction};};/**
* Creates the dispatched ROUTE_DID_LEAVE action object.
* @param {Object} route The route object.
* @param {string} historyAction The history action.
* @return {Object} The dispatched action object.
*/export var routeDidLeave=function routeDidLeave(route,historyAction){return{type:ROUTE_DID_LEAVE,route:route,historyAction:historyAction};};/**
* Creates the dispatched ROUTE_DID_UPDATE action object.
* @param {Object} route The route object.
* @param {string} historyAction The history action.
* @return {Object} The dispatched action object.
*/export var routeDidUpdate=function routeDidUpdate(route,historyAction){return{type:ROUTE_DID_UPDATE,route:route,historyAction:historyAction};};