Comparing version 4.2.0 to 4.2.1
@@ -643,1 +643,17 @@ var List = require('can-list'); | ||
}); | ||
QUnit.test("list receives patch events", function() { | ||
QUnit.expect(2); | ||
var list = new List([]); | ||
function handler(patches) { | ||
if(patches[0].index === 0 && patches[0].insert) { | ||
QUnit.ok(true); | ||
} | ||
} | ||
canReflect.onPatches(list, handler); | ||
list.push("foo"); | ||
list.attr(0, "bar"); | ||
canReflect.offPatches(list, handler); | ||
}); |
@@ -18,3 +18,2 @@ "use strict"; | ||
// Helpers for `observable` lists. | ||
@@ -87,3 +86,3 @@ var splice = [].splice, | ||
canEvent.dispatch.call(this, 'length', [this.length]); | ||
//canEvent.dispatch.call(this, 'can.patches', [patches]); | ||
canEvent.dispatch.call(this, 'can.patches', [patches]); | ||
} else if (how === 'remove') { | ||
@@ -93,3 +92,3 @@ patches = [{index: index, deleteCount: oldVal.length, type: "splice"}]; | ||
canEvent.dispatch.call(this, 'length', [this.length]); | ||
//canEvent.dispatch.call(this, 'can.patches', [patches]); | ||
canEvent.dispatch.call(this, 'can.patches', [patches]); | ||
} else { | ||
@@ -104,2 +103,11 @@ canEvent.dispatch.call(this, how, [newVal, index]); | ||
}, | ||
__get: function(prop){ | ||
prop = isNaN(+prop) || (prop % 1) ? prop : +prop; | ||
if(typeof prop === "number") { | ||
ObservationRecorder.add(this, "can.patches"); | ||
return this.___get( "" + prop ); | ||
} else { | ||
return Map.prototype.__get.call(this, prop); | ||
} | ||
}, | ||
___get: function (attr) { | ||
@@ -855,2 +863,8 @@ if (attr) { | ||
this.splice.apply(this, [index, deleteCount].concat(insert)); | ||
}, | ||
"can.onPatches": function(handler,queue){ | ||
this[canSymbol.for("can.onKeyValue")]("can.patches", handler,queue); | ||
}, | ||
"can.offPatches": function(handler,queue) { | ||
this[canSymbol.for("can.offKeyValue")]("can.patches", handler,queue); | ||
} | ||
@@ -857,0 +871,0 @@ }); |
{ | ||
"name": "can-list", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "Observable lists", | ||
@@ -58,3 +58,3 @@ "homepage": "http://canjs.com", | ||
"steal-tools": "^1.1.2", | ||
"testee": "^0.8.0" | ||
"testee": "^0.9.0" | ||
}, | ||
@@ -61,0 +61,0 @@ "repository": { |
# can-list | ||
[![Join the chat at https://gitter.im/canjs/canjs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/canjs/canjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![Join our Slack](https://img.shields.io/badge/slack-join%20chat-611f69.svg)](https://www.bitovi.com/community/slack?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![Join our Discourse](https://img.shields.io/discourse/https/forums.bitovi.com/posts.svg)](https://forums.bitovi.com/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/canjs/can-list/blob/master/LICENSE.md) | ||
[![npm version](https://badge.fury.io/js/can-list.svg)](https://www.npmjs.com/package/can-list) | ||
[![Travis build status](https://travis-ci.org/canjs/can-list.svg?branch=master)](https://travis-ci.org/canjs/can-list) | ||
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/canjs/can-list?branch=master&svg=true)](https://ci.appveyor.com/project/matthewp/can-list) | ||
[![Coverage status](https://coveralls.io/repos/github/canjs/can-list/badge.svg?branch=master)](https://coveralls.io/github/canjs/can-list?branch=master) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/canjs/can-list.svg)](https://greenkeeper.io/) | ||
@@ -15,3 +14,3 @@ | ||
Read the [API docs on CanJS.com](https://canjs.com/doc/can-list.html). | ||
Read the [can-list API docs on CanJS.com](https://canjs.com/doc/can-list.html). | ||
@@ -29,2 +28,1 @@ ## Changelog | ||
[MIT](https://github.com/canjs/can-list/blob/master/LICENSE.md) | ||
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
275489
24
6619
27
2