Skip to content

Router Streams

Triggers on every routing action.

import { navigate$ } from '@shopgate/engage/core';
subscribe(navigate$, ({ action, dispatch, getState, prevState, events }) => {
// The code you want to perform when the stream triggers.
})

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { navigate$ } from '@shopgate/pwa-common/streams/router'


Triggers before a route enters.

import { routeWillEnter$ } from '@shopgate/engage/core';
subscribe(routeWillEnter$, ({ action, dispatch, getState, prevState, events }) => {
// The code you want to perform when the stream triggers.
})

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { routeWillEnter$ } from '@shopgate/pwa-common/streams/router'


Triggers when a route entered.

import { routeDidEnter$ } from '@shopgate/engage/core';
subscribe(routeDidEnter$, ({ action, dispatch, getState, prevState, events }) => {
// The code you want to perform when the stream triggers.
})

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { routeDidEnter$ } from '@shopgate/pwa-common/streams/router'


Triggers before a route leaves.

import { routeWillLeave$ } from '@shopgate/engage/core';
subscribe(routeWillLeave$, ({ action, dispatch, getState, prevState, events }) => {
// The code you want to perform when the stream triggers.
})

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { routeWillLeave$ } from '@shopgate/pwa-common/streams/router'


Triggers after the route leaves.

import { routeDidLeave$ } from '@shopgate/engage/core';
subscribe(routeDidLeave$, ({ action, dispatch, getState, prevState, events }) => {
// The code you want to perform when the stream triggers.
})

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { routeDidLeave$ } from '@shopgate/pwa-common/streams/router'


Triggers on any of the previous route changes.

Attention: This stream is deprecated from Engage v6.4.0. Please use routeDidEnter$ instead.

import { routeDidChange$ } from '@shopgate/engage/core';
subscribe(routeDidChange$, ({ action, dispatch, getState, prevState, events }) => {
// The code you want to perform when the stream triggers.
})

Attention: The path to the old modules is deprecated and will be removed in ENGAGE v7: import { routeDidChange$ } from '@shopgate/pwa-common/streams/router'