navigation-stack 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,39 +1,39 @@
1
- name: Build and test
2
- on:
3
- push:
4
- branches: [master]
5
- pull_request:
6
- branches: [master]
7
-
8
- env:
9
- DISPLAY: :99.0
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
- strategy:
15
- matrix:
16
- browser: ['ChromeCi', 'Firefox']
17
- node-version: [16.x]
18
-
19
- steps:
20
- - uses: actions/checkout@v2
21
- - name: Use Node.js ${{ matrix.node-version }}
22
- uses: actions/setup-node@v1
23
- with:
24
- node-version: ${{ matrix.node-version }}
25
-
26
- - name: Setup firefox
27
- if: ${{ matrix.browser == 'Firefox' }}
28
- uses: browser-actions/setup-firefox@latest
29
- with:
30
- firefox-version: 'latest'
31
- - name: Setup xvfb
32
- run: |
33
- sudo apt-get install xvfb
34
- Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
35
- - run: yarn install --frozen-lockfile
36
- - env:
37
- BROWSER: ${{ matrix.browser }}
38
- run: yarn test --coverage
39
- - run: node_modules/.bin/codecov
1
+ name: Build and test
2
+ on:
3
+ push:
4
+ branches: [master]
5
+ pull_request:
6
+ branches: [master]
7
+
8
+ env:
9
+ DISPLAY: :99.0
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ browser: ['ChromeCi', 'Firefox']
17
+ node-version: [16.x]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Use Node.js ${{ matrix.node-version }}
22
+ uses: actions/setup-node@v1
23
+ with:
24
+ node-version: ${{ matrix.node-version }}
25
+
26
+ - name: Setup firefox
27
+ if: ${{ matrix.browser == 'Firefox' }}
28
+ uses: browser-actions/setup-firefox@latest
29
+ with:
30
+ firefox-version: 'latest'
31
+ - name: Setup xvfb
32
+ run: |
33
+ sudo apt-get install xvfb
34
+ Xvfb $DISPLAY -screen 0 1024x768x24 > /dev/null 2>&1 &
35
+ - run: yarn install --frozen-lockfile
36
+ - env:
37
+ BROWSER: ${{ matrix.browser }}
38
+ run: yarn test --coverage
39
+ - run: node_modules/.bin/codecov
package/README.md CHANGED
@@ -1,27 +1,9 @@
1
- <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
- <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
- **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4
-
5
- - [navigation-stack](#navigation-stack)
6
- - [Install](#install)
7
- - [Use](#use)
8
- - [Current Location](#current-location)
9
- - [Why Redux?](#why-redux)
10
- - [Environment](#environment)
11
- - [Base Path](#base-path)
12
- - [Location State Storage](#location-state-storage)
13
- - [Block Navigation](#block-navigation)
14
- - [Utility](#utility)
15
- - [Development](#development)
16
-
17
- <!-- END doctoc generated TOC please keep comment here to allow auto update -->
18
-
19
1
  # navigation-stack
20
2
 
21
3
  [![npm version](https://img.shields.io/npm/v/navigation-stack.svg?style=flat-square)](https://www.npmjs.com/package/navigation-stack)
22
4
  [![npm downloads](https://img.shields.io/npm/dm/navigation-stack.svg?style=flat-square)](https://www.npmjs.com/package/navigation-stack)
23
5
 
24
- Handles web browser navigation in a web application.
6
+ Handles navigation in a web browser. Represents web browser navigation history as a "stack" data structure. Provides operations to perform programmatic navigation such as "push" (go to new URL), "replace" (redirect to new URL), "shift" (rewind to a previously visited URL). Provides a subscription mechanism to get notified on current location change.
25
7
 
26
8
  Originally forked from [`farce`](http://npmjs.com/package/farce) package to fix a [bug](https://github.com/4Catalyzer/farce/issues/483).
27
9
 
@@ -102,9 +84,11 @@ function reducer(state, action) {
102
84
  }
103
85
  ```
104
86
 
105
- Calling `store.dispatch(Actions.init())` will trigger the initial `ActionTypes.UPDATE` action which will set the current location. From then on, the current location will always stay in sync with the web browser's URL bar.
87
+ With this reducer, `store.getState()` will return the current location.
88
+
89
+ Calling `store.dispatch(Actions.init())` will trigger the initial `ActionTypes.UPDATE` action which will set the initial current location. From then on, the current location will always stay in sync with the web browser's URL bar, including "Back"/"Forward" navigation.
106
90
 
107
- The current location will also "magically" be updated when the user clicks "Back" or "Forward" button in the web browser.
91
+ One could use Redux'es standard [subscription mechanisms](https://redux.js.org/api/store#subscribelistener) to immediately get notified of current location changes.
108
92
 
109
93
  ## Why Redux?
110
94
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "navigation-stack",
3
- "version": "0.1.0",
4
- "description": "Handles web browser navigation in a web application",
3
+ "version": "0.1.2",
4
+ "description": "Handles navigation in a web browser",
5
5
  "keywords": [
6
6
  "history",
7
7
  "browser",
@@ -40,8 +40,7 @@
40
40
  }
41
41
  },
42
42
  "lint-staged": {
43
- "*": "yarn 4c lint --fix --prettier-ignore .eslintignore",
44
- "README.md": "doctoc"
43
+ "*": "yarn 4c lint --fix --prettier-ignore .eslintignore"
45
44
  },
46
45
  "prettier": "@4c/prettier-config",
47
46
  "dependencies": {
package/types/index.d.ts CHANGED
@@ -184,7 +184,7 @@ export const Actions: {
184
184
  init(): InitAction;
185
185
  push(location: InputLocation): PushAction;
186
186
  replace(location: InputLocation): ReplaceAction;
187
- go(delta: number): RewindAction;
187
+ shift(delta: number): RewindAction;
188
188
  dispose(): DisposeAction;
189
189
  };
190
190
 
@@ -199,7 +199,7 @@ export interface Environment {
199
199
 
200
200
  navigate(location: LocationBase): Location;
201
201
 
202
- go(delta: number): void;
202
+ shift(delta: number): void;
203
203
 
204
204
  addBeforeDestroyListener(listener: BeforeDestroyListener): void;
205
205
 
@@ -218,7 +218,7 @@ declare abstract class EnvironmentBase implements Environment {
218
218
 
219
219
  navigate(location: LocationBase): Location;
220
220
 
221
- go(delta: number): void;
221
+ shift(delta: number): void;
222
222
 
223
223
  addBeforeDestroyListener(listener: BeforeDestroyListener): void;
224
224
 
Binary file