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

can-route

Package Overview
Dependencies
Maintainers
13
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-route - npm Package Compare versions

Comparing version 4.3.0 to 4.3.1

21

doc/can-route.md

@@ -52,3 +52,3 @@ @module {Object} can-route can-route

create history enabled single-page apps. However,
`route` addresses several other needs such as:
`route` addresses several other needs aswell, such as:

@@ -76,3 +76,3 @@ - Pretty urls.

Underlying `can-route` is an observable map: [can-route.data can-route.data]. Depending on what type of map your application uses this could be a [can-define/map/map], [can-observe.Object] or maybe even a [can-simple-map].
Underlying `can-route` is an observable map: [can-route.data can-route.data]. Depending on what type of map your application uses this could be a [can-define/map/map], an [can-observe.Object] or maybe even a [can-simple-map].

@@ -116,3 +116,3 @@ Typically, the map is the view-model of the top-level [can-component] in your

> NOTE: The `route.data = document.querySelector("my-app")` statement is what
> __Note__: The `route.data = document.querySelector("my-app")` statement is what
> sets `route.data` to `<my-app>`'s view-model.

@@ -126,2 +126,3 @@

import route from "can-route";
const AppViewModel = DefineMap.extend( {

@@ -142,3 +143,3 @@ page: "string"

Listen to changes in the url by listening on the underlying route data. For example,
You can listen to changes in the url by listening on the underlying route data. For example,
your route data and rule might have a page property:

@@ -159,4 +160,3 @@

route.data.on( "page", function( ev, newVal, oldVal ) {
// page changed from "recipes" to "settings"
// page changed from "recipes" to "settings"
} );

@@ -191,3 +191,2 @@ ```

route.data.type = "image/bar";
// OR

@@ -210,3 +209,3 @@ route.attr( "type", "image/bar" );

an object (that is the route’s data).
In order to map to a specific properties in the url,
In order to map to specific properties in the url,
prepend a colon to the name of the property like:

@@ -295,5 +294,5 @@

The matched rule is stored in the compute `route.currentRule` and is used to set the `window.location.hash`. The process can-route uses to find the matched rule is:
- Find all routes with all of their map properties set
- If multiple routes are matched, find the route with the highest number of set properties
- If multiple routes are still matched, use the route that was registered first
1. Find all routes with all of their map properties set
2. If multiple routes are matched, find the route with the highest number of set properties
3. If multiple routes are still matched, use the route that was registered first

@@ -300,0 +299,0 @@ ### Find all routes with all of their map properties set

@@ -13,2 +13,3 @@ @property {Object|HTMLElement} can-route.data data

import route from "can-route";
route.data = new DefineMap( { page: "" } );

@@ -27,2 +28,3 @@ route.register( "{page}" );

import route from "can-route";
Component.extend( {

@@ -94,3 +96,3 @@ tag: "my-app",

It also shows an example of a "virtual" property on the AppViewModel, locationIds, which is the serialized version of a non-serializeable can.List, locations. A setter is defined on locationIds, which will translate changes in locationIds back to the locations can.List.
It also shows an example of a "virtual" property on the AppViewModel called locationIds, which is the serialized version of a non-serializeable can.List called locations. A setter is defined on locationIds, which will translate changes in locationIds back to the locations can.List.

@@ -97,0 +99,0 @@ ```js

{
"name": "can-route",
"version": "4.3.0",
"version": "4.3.1",
"description": "Observable front-end application routing for CanJS.",

@@ -5,0 +5,0 @@ "homepage": "https://canjs.com/doc/can-route.html",

@@ -57,3 +57,3 @@ "use strict";

*
* var result = route.deparam("page=home");
* const result = route.deparam("page=home");
* console.log(result.page); // -> "home"

@@ -60,0 +60,0 @@ * ```

@@ -89,3 +89,3 @@ "use strict";

*
* Make an anchor tag (`<A>`) that when clicked on will update can-route's
* Make an anchor tag (`<a>`) that when clicked on will update can-route's
* properties to match those in `data`.

@@ -150,3 +150,3 @@ *

*
* ```
* ```js
* route.data.set({page: "recipes", id: '5'});

@@ -153,0 +153,0 @@ *

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