Skip to content

Commit

Permalink
Merge pull request #31 from guillotinaweb/navigate
Browse files Browse the repository at this point in the history
Action to trigger traversing navigation
  • Loading branch information
ebrehault authored Sep 10, 2020
2 parents 5d3b1b8 + 837c48d commit fccf05b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.4.0 (2020-09-09)

## Improvement
- Action to trigger traversing navigation [ebrehault]

# 1.3.0 (2020-07-06)

## New feature
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-state-traverser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@guillotinaweb/ngx-state-traverser",
"version": "1.3.0",
"version": "1.4.0",
"license": "MIT",
"author": {
"name": "Eric Brehault",
Expand Down
7 changes: 7 additions & 0 deletions projects/ngx-state-traverser/src/lib/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export namespace TraverserActions {
export enum Types {
Watch = '[Traversal] Watch',
Traverse = '[Traversal] Traverse',
TraverseAndNavigate = '[Traversal] Traverse and navigate',
ResolveContext = '[Traversal] Resolve context',
Resolve = '[Traversal] Resolve',
ResolveMany = '[Traversal] Resolve many',
Expand All @@ -21,6 +22,11 @@ export namespace TraverserActions {
constructor(readonly payload: string) {}
}

export class TraverseAndNavigate implements Action {
readonly type = Types.TraverseAndNavigate;
constructor(readonly payload: string) {}
}

export class ResolveContext implements Action {
readonly type = Types.ResolveContext;
constructor(readonly payload: Target) {}
Expand Down Expand Up @@ -68,6 +74,7 @@ export namespace TraverserActions {

export type Actions =
| Traverse
| TraverseAndNavigate
| ResolveContext
| Resolve
| ResolveMany
Expand Down
7 changes: 7 additions & 0 deletions projects/ngx-state-traverser/src/lib/effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ export class StateTraverserEffect {
)
);

@Effect({dispatch: false})
navigateTo = this.actions
.pipe(
ofType<TraverserActions.TraverseAndNavigate>(TraverserActions.Types.TraverseAndNavigate),
tap(action => this.traverser.traverse(action.payload))
);

@Effect({dispatch: false})
loadTile = this.actions
.pipe(
Expand Down

0 comments on commit fccf05b

Please sign in to comment.