can-route-pushstate
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -13,8 +13,8 @@ @module {Object} can-route-pushstate | ||
```js | ||
var route = require("can-route-pushstate"); | ||
import route from "can-route-pushstate"; | ||
route("{page}", { page: "home" }); | ||
route( "{page}", { page: "home" } ); | ||
route.start(); | ||
route.attr("page", "user"); | ||
route.attr( "page", "user" ); | ||
@@ -39,5 +39,5 @@ location.pathname; // -> "/user" | ||
```js | ||
route("{page}", {page: 'homepage'}); | ||
route("contacts/{username}"); | ||
route("books/{genre}/{author}"); | ||
route( "{page}", { page: "homepage" } ); | ||
route( "contacts/{username}" ); | ||
route( "books/{genre}/{author}" ); | ||
@@ -58,11 +58,11 @@ route.start(); // Initializes can-route | ||
```js | ||
route.attr('page', 'about'); | ||
route.attr( "page", "about" ); | ||
route.attr(); //-> {page: "about", route: "{page}"} | ||
// without cleaning current route state | ||
route.attr('username', 'veljko'); | ||
route.attr( "username", "veljko" ); | ||
route.attr(); //-> {page: "about", route: "{page}", username: 'veljko'} | ||
// with cleaning current can-route state | ||
route.attr({username: 'veljko'}, true); | ||
route.attr( { username: "veljko" }, true ); | ||
route.attr(); //-> {username: "veljko", route: "contacts/{username}"} | ||
@@ -74,3 +74,3 @@ ``` | ||
```js | ||
route.attr({genre: 'sf', author: 'adams'}, true); | ||
route.attr( { genre: "sf", author: "adams" }, true ); | ||
route.attr(); //-> {genre: "sf", author: "adams", route: "books/{genre}/{author}"} | ||
@@ -89,3 +89,3 @@ ``` | ||
```js | ||
route.url({username: 'justinbmeyer'}); //-> '/contacts/justinbmeyer' | ||
route.url( { username: "justinbmeyer" } ); //-> '/contacts/justinbmeyer' | ||
``` | ||
@@ -100,9 +100,10 @@ | ||
```js | ||
route.bind('username', function(ev, newVal, oldVal) { | ||
route.bind( "username", function( ev, newVal, oldVal ) { | ||
//-> ev: {EventObject} | ||
//-> newVal: 'nikica' | ||
//-> oldVal: 'veljko' | ||
}); | ||
} ); | ||
route.attr({username: nikica}, true); | ||
route.attr( { username: nikica }, true ); | ||
``` | ||
@@ -115,6 +116,6 @@ | ||
```js | ||
route.bindings.pushstate.root = "/contacts/" | ||
route("{page}"); | ||
route.url({page: "list"}) //-> "/contacts/list" | ||
route.url({foo: "bar"}) //-> "/contacts/?foo=bar" | ||
route.bindings.pushstate.root = "/contacts/"; | ||
route( "{page}" ); | ||
route.url( { page: "list" } ); //-> "/contacts/list" | ||
route.url( { foo: "bar" } ); //-> "/contacts/?foo=bar" | ||
``` | ||
@@ -131,4 +132,4 @@ | ||
```js | ||
route.replaceStateOn('page', 'action'); | ||
route.attr('page', 'dashboard'); // Route changes, no new history record | ||
route.replaceStateOn( "page", "action" ); | ||
route.attr( "page", "dashboard" ); // Route changes, no new history record | ||
``` | ||
@@ -139,4 +140,4 @@ | ||
```js | ||
route.replaceStateOff('action'); | ||
route.attr('action', 'remove'); // Route changes, new history record is created | ||
route.replaceStateOff( "action" ); | ||
route.attr( "action", "remove" ); // Route changes, new history record is created | ||
``` | ||
@@ -147,5 +148,5 @@ | ||
```js | ||
route.replaceStateOnce('page'); | ||
route.attr('page', 'dashboard'); // No new history record | ||
route.attr('page', 'search'); // New history record is created | ||
route.replaceStateOnce( "page" ); | ||
route.attr( "page", "dashboard" ); // No new history record | ||
route.attr( "page", "search" ); // New history record is created | ||
``` | ||
@@ -152,0 +153,0 @@ |
{ | ||
"name": "can-route-pushstate", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Pushstate for can-route", | ||
@@ -5,0 +5,0 @@ "homepage": "https://canjs.com/doc/can-route-pushstate.html", |
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
51150
1