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

can-route

Package Overview
Dependencies
Maintainers
7
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 3.2.3 to 3.2.4

26

can-route.js

@@ -880,11 +880,25 @@ /*jshint -W079 */

// instead act on the `canRoute.data` observe.
each(['addEventListener','removeEventListener','bind', 'unbind', 'on', 'off', 'delegate', 'undelegate', 'removeAttr', 'compute', '_get', '___get','each'], function (name) {
var bindToCanRouteData = function(name, args) {
if (!canRoute.data[name]) {
return;
}
return canRoute.data[name].apply(canRoute.data, args);
};
each(['addEventListener','removeEventListener','bind', 'unbind', 'on', 'off'], function(name) {
// exposing all internal canEvent evt's to canRoute
canRoute[name] = function(eventName) {
if (eventName === '__url') {
return canEvent[name].apply(eventsObject, arguments);
}
return bindToCanRouteData(name, arguments);
};
});
each(['delegate', 'undelegate', 'removeAttr', 'compute', '_get', '___get', 'each'], function (name) {
canRoute[name] = function () {
// `delegate` and `undelegate` require
// the `can/map/delegate` plugin
if (!canRoute.data[name]) {
return;
}
return canRoute.data[name].apply(canRoute.data, arguments);
return bindToCanRouteData(name, arguments);
};

@@ -891,0 +905,0 @@ });

@@ -5,3 +5,4 @@ @function can-route can-route

@test can-route/test.html
@parent can-core
@parent can-routing
@collection can-core
@link ../docco/route/route.html docco

@@ -96,8 +97,8 @@ @package ./package.json

Listen to changes in history by [can-event.addEventListener listening] to
changes in can-route like:
changes of can-route's `matched` compute:
```js
route.on('foo', function(ev, attr, how, newVal, oldVal) {
// Foo changed!
})
route.matched.on('change', function(ev, attr, how, newVal, oldVal) {
// attr changed from oldVal -> newVal
});
```

@@ -104,0 +105,0 @@

{
"name": "can-route",
"version": "3.2.3",
"version": "3.2.4",
"description": "",

@@ -21,3 +21,3 @@ "homepage": "",

"testee": "testee test/test.html --browsers firefox",
"test": "npm run jshint && npm run testee",
"test": "npm run detect-cycle && npm run jshint && npm run testee",
"jshint": "jshint ./*.js --config",

@@ -29,3 +29,4 @@ "release:pre": "npm version prerelease && npm publish --tag pre",

"build": "node build.js",
"develop": "done-serve --static --develop --port 8080"
"develop": "done-serve --static --develop --port 8080",
"detect-cycle": "detect-cyclic-packages --ignore done-serve"
},

@@ -61,2 +62,3 @@ "main": "can-route",

"can-stache-key": "^0.1.0",
"detect-cyclic-packages": "^1.1.0",
"done-serve": "^0.2.0",

@@ -63,0 +65,0 @@ "jshint": "^2.9.1",

@@ -1096,1 +1096,43 @@ /* jshint asi:true */

});
test("triggers __url event anytime a there's a change to individual properties", function(){
mockRoute.start();
var AppState = DefineMap.extend({seal: false},{"*": "stringOrObservable"});
var appState = new AppState({});
canRoute.data = appState;
canRoute('{page}');
canRoute('{page}/{section}');
QUnit.stop();
canRoute.ready();
var matchedCount = 0;
canRoute.on('__url', function() {
// any time a route property is changed, not just the matched route
matchedCount++;
});
setTimeout(function() {
canRoute.data.page = 'two';
}, 30);
setTimeout(function() {
canRoute.data.section = 'a';
}, 60);
setTimeout(function() {
canRoute.data.section = 'b';
}, 90);
setTimeout(function(){
// 1st call is going from undefined to empty string
equal(matchedCount, 4, 'calls __url event every time a property is changed');
mockRoute.stop();
QUnit.start();
}, 200);
});
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