can-route-pushstate
Advanced tools
Comparing version 3.1.2 to 3.2.0
@@ -31,8 +31,7 @@ // # can/route/pushstate/pushstate.js | ||
if (usePushStateRouting) { | ||
// Registers itself within `route.bindings`. | ||
route.bindings.pushstate = { | ||
/** | ||
* @property {String} route.pushstate.root | ||
* @parent route.pushstate | ||
* @property {String} can-route-pushstate.root root | ||
* @parent can-route-pushstate.static | ||
* | ||
@@ -39,0 +38,0 @@ * @description Configure the base url that will not be modified. |
@module {Object} can-route-pushstate | ||
@parent can-core | ||
@parent can-routing | ||
@collection can-core | ||
@package ./package.json | ||
@group can-route-pushstate.static static | ||
@@ -115,2 +117,29 @@ @description Changes [can-route] to use | ||
### Updating the current route | ||
can-route-pushstate also allows changes to the current route state without creating a new history entry. This behavior can be controlled using the `replaceStateOn`, `replaceStateOff`, and `replaceStateOnce` methods. | ||
Enable the behavior by calling `replaceStateOn` with specified route property keys like: | ||
```js | ||
route.replaceStateOn('page', 'action'); | ||
route.attr('page', 'dashboard'); // Route changes, no new history record | ||
``` | ||
To return the `attr` call back to normal the `pushstate` behavior, call `replaceStateOff` with the specified route property keys like: | ||
```js | ||
route.replaceStateOff('action'); | ||
route.attr('action', 'remove'); // Route changes, new history record is created | ||
``` | ||
The behavior can be configured to occur only once for a specific property using `replaceStateOnce` like: | ||
```js | ||
route.replaceStateOnce('page'); | ||
route.attr('page', 'dashboard'); // No new history record | ||
route.attr('page', 'search'); // New history record is created | ||
``` | ||
## Planning route structure | ||
@@ -117,0 +146,0 @@ |
{ | ||
"name": "can-route-pushstate", | ||
"version": "3.1.2", | ||
"version": "3.2.0", | ||
"description": "Pushstate for can-route", | ||
@@ -5,0 +5,0 @@ "homepage": "https://canjs.com", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
45256
17
1008