svelte-guard-history-router
Advanced tools
Comparing version 1.1.5 to 1.1.6
{ | ||
"name": "svelte-guard-history-router", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"module": "src/index.mjs", | ||
"svelte": "src/index.svelte", | ||
"description": "svelte guarded history router", | ||
"description": "svelte router for spa with history only", | ||
"keywords": [ | ||
"svelte", | ||
"router" | ||
"router", | ||
"spa" | ||
], | ||
@@ -22,7 +23,7 @@ "scripts": { | ||
"documentation": "^12.1.2", | ||
"rollup": "^1.23.1", | ||
"rollup": "^1.24.0", | ||
"rollup-plugin-dev": "1.0.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-svelte": "^5.1.0", | ||
"semantic-release": "^15.13.25", | ||
"semantic-release": "^15.13.26", | ||
"svelte": "^3.12.1", | ||
@@ -32,3 +33,3 @@ "testcafe": "^1.5.0" | ||
"engines": { | ||
"node": ">=12.11.1" | ||
"node": ">=12.12.0" | ||
}, | ||
@@ -35,0 +36,0 @@ "repository": { |
@@ -50,2 +50,17 @@ [![Build Status](https://secure.travis-ci.org/arlac77/svelte-guard-history-router.png)](http://travis-ci.org/arlac77/svelte-guard-history-router) | ||
## Sample code | ||
Check out the code in the [example](/example) folder. | ||
To run the sample, clone the repository, install the dependencies, and start: | ||
```sh | ||
git clone https://github.com/arlac77/svelte-guard-history-router | ||
cd svelte-guard-history-router | ||
npm install | ||
npm start | ||
``` | ||
then navigate to [localhost:5000](http://localhost:5000/) | ||
## run tests | ||
@@ -117,2 +132,14 @@ | ||
Keys also act as svelte stores and can be subscribed. | ||
```js | ||
export const article = derived( | ||
[articles, router.keys.article], | ||
([$articles, $id], set) => { | ||
set($articles.find(a => a.id === $id)); | ||
return () => {}; | ||
} | ||
); | ||
``` | ||
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | ||
@@ -124,2 +151,3 @@ | ||
- `value` **any** | ||
- `subscriptions` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)** | ||
@@ -213,7 +241,8 @@ ## RouterState | ||
Halt current transition and got to another route | ||
Halt current transition and go to another route. | ||
To proceed with the original route by call continue() | ||
#### Parameters | ||
- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** new route to enter temprorarly | ||
@@ -361,7 +390,27 @@ ### continue | ||
```shell | ||
npm svelte-guard-history-router | ||
npm install svelte-guard-history-router | ||
``` | ||
With [yarn](https://yarnpkg.com) do: | ||
```shell | ||
yarn add svelte-guard-history-router | ||
``` | ||
# SPA integrating with a nginx backend | ||
All unresolvable requests are redirected to /sericeBase/index.html | ||
- /deploymantLocation is the location of the frontend in the servers file system | ||
- /serviceBase is the url path as seen from the browser | ||
```nginx.conf | ||
location /serviceBase { | ||
alias /deploymantLocation; | ||
try_files $uri$args $uri$args/ /sericeBase/index.html; | ||
} | ||
``` | ||
# license | ||
BSD-2-Clause |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32700
412
494