libs/ngx-pfe/pfe-actions/rewind-history/rewind-history.model.ts
Properties |
|
clearHistory |
clearHistory:
|
Type : boolean
|
Optional |
Ignore all other options and completely clear the history. |
keepSelf |
keepSelf:
|
Type : boolean
|
Optional |
Only remove all pages that appear after the page, but keep the page itself |
pageId |
pageId:
|
Type : string | JsonPathExpression
|
Optional |
The pageId for the history to be rewinded to, can optionally be specified. If no pageId is given, the current pageId is used. The pageId can either be a static string or a JsonPathExpression. This makes it possible to access values like the _pfe.navigationState It might be necessary to specify the pageId for cases where the rewind happens in between two pages. (During navigation) |
import { JsonPathExpression } from '../../models/jsonpath-expression-type.model';
import { PfeBaseActionConfig } from '../pfe-actions.model';
// eslint-disable-next-line @typescript-eslint/naming-convention
export const PfeRewindHistory = 'PFE_REWIND_HISTORY';
export interface RewindHistoryActionConfig extends PfeBaseActionConfig {
/**
* The PFE_REWIND_HISTORY action allows it to remove a page and all pages that appear after the earliest occurrence of the given page in the history.
* Optionally it is also possible to keep the page itself and to only remove all later pages.
* It is also possible to clear the complete history.
*
* It is possible to optionally specify a pageId. The default is the current page.
*
* Examples:
*
* Example 01: Clear the complete history:
*
```json
{
"type": "PFE_REWIND_HISTORY",
"clearHistory": true,
},
```
*
* Example 02: onPageEnterActions: Remove all pages, after the page that is being entered;
*
```json
"onPageEnterActions": [
{
"type": "PFE_REWIND_HISTORY",
"pageId": "$._pfe.navigationState.navigatingTo"
}
]
```
* `$._pfe.navigationState.navigatingTo` has to be used here to determine the id of the current page, as it will only become the current page after the onPageEnterActions ran.
* That means at this point in time, the page that we're entering is not yet the current page.
* Example 03: When going to a specific page, remove all pages after that page from the history. Scenario: The user jumps back in the flow and might go down another path.
*
```json
"onNavigationStartActions": [
{
"type": "PFE_REWIND_HISTORY",
"pageId": "$._pfe.navigationState.navigatingTo",
"conditions": [
{
"value1Expression": "$._pfe.navigationState.navigatingTo",
"operator": "==",
"value2Expression": "welcomePage"
}
]
}
]
```
*
* The page itself will also be removed from the history. Once it is entered after the navigation, it is added again.
*
*/
type: typeof PfeRewindHistory;
/**
* Ignore all other options and completely clear the history.
*/
clearHistory?: boolean;
/**
* The pageId for the history to be rewinded to, can optionally be specified.
* If no pageId is given, the current pageId is used.
*
* The pageId can either be a static string or a JsonPathExpression. This makes it possible to access values like the _pfe.navigationState
*
* It might be necessary to specify the pageId for cases where the rewind happens in between two pages. (During navigation)
*/
pageId?: string | JsonPathExpression;
/**
* Only remove all pages that appear after the page, but keep the page itself
*/
keepSelf?: boolean;
}