UNPKG

@shopgate/engage

Version:
16 lines 1.18 kB
import{UIEvents}from'@shopgate/pwa-core';import{router}from'@virtuous/conductor';export var NAVIGATION_PUSH='navigation.push';export var NAVIGATION_POP='navigation.pop';export var NAVIGATION_REPLACE='navigation.replace';export var NAVIGATION_RESET='navigation.reset';/** * Performs the PUSH navigation action. * @param {Object} params The history params. */export function push(params){UIEvents.emit(NAVIGATION_PUSH,params);}/** * Performs the POP navigation action. */export function pop(){UIEvents.emit(NAVIGATION_POP);}/** * Performs the REPLACE navigation action. * @param {Object} params The history params. */export function replace(params){UIEvents.emit(NAVIGATION_REPLACE,params);}/** * Performs the RESET navigation action. * @param {Object} params The history params. */export function reset(){UIEvents.emit(NAVIGATION_RESET);}/** * Performs the UPDATE navigation action. * @param {Object} state The meta state to add to a existing route. * @param {string} [routeId] The ID of the route to update. */export function update(state){var routeId=arguments.length>1&&arguments[1]!==undefined?arguments[1]:router.getCurrentRoute().id;router.update(routeId,state);}