Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-route-pushstate

Package Overview
Dependencies
Maintainers
9
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-route-pushstate - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

51

can-route-pushstate.md

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc