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

can-map

Package Overview
Dependencies
Maintainers
7
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-map - npm Package Compare versions

Comparing version 4.0.0-pre.5 to 4.0.0-pre.6

9

can-map_test.js

@@ -541,1 +541,10 @@ /* jshint asi:true */

});
QUnit.test("can.isBound", function(){
var Person = Map.extend({
first: "any",
last: "any"
});
var p = new Person();
QUnit.ok(! p[canSymbol.for("can.isBound")](), "not bound");
});

99

can-map.js

@@ -525,57 +525,4 @@ /* jshint -W079 */

// ### _bindsetup and _bindteardown
// Placeholders for bind setup and teardown.
//_eventSetup: function(){},
//_eventTeardown: function(){},
// ### one
// Listens once to an event.
one: canEvent.one,
// ### bind
// Listens to an event on a map.
// If the event is a computed property,
// listen to the compute and forward its events
// to this map.
addEventListener: function (eventName, handler) {
var computedBinding = this._computedAttrs && this._computedAttrs[eventName];
if (computedBinding && computedBinding.compute) {
if (!computedBinding.count) {
computedBinding.count = 1;
canReflect.onValue(computedBinding.compute, computedBinding.handler, "notify");
} else {
computedBinding.count++;
}
}
// Sets up bubbling if needed.
bubble.bind(this, eventName);
return canEvent.addEventListener.apply(this, arguments);
},
// ### unbind
// Stops listening to an event.
// If this is the last listener of a computed property,
// stop forwarding events of the computed property to this map.
removeEventListener: function (eventName, handler) {
var computedBinding = this._computedAttrs && this._computedAttrs[eventName];
if (computedBinding) {
if (computedBinding.count === 1) {
computedBinding.count = 0;
canReflect.offValue(computedBinding.compute, computedBinding.handler);
} else {
computedBinding.count--;
}
}
// Teardown bubbling if needed.
bubble.unbind(this, eventName);
return canEvent.removeEventListener.apply(this, arguments);
},
// ### compute

@@ -632,4 +579,50 @@ // Creates a compute that represents a value on this map. If the property is a function

// makes it so things can read this.
canEvent(Map.prototype);
// ### bind
// Listens to an event on a map.
// If the event is a computed property,
// listen to the compute and forward its events
// to this map.
Map.prototype.addEventListener = function (eventName, handler) {
var computedBinding = this._computedAttrs && this._computedAttrs[eventName];
if (computedBinding && computedBinding.compute) {
if (!computedBinding.count) {
computedBinding.count = 1;
canReflect.onValue(computedBinding.compute, computedBinding.handler, "notify");
} else {
computedBinding.count++;
}
}
// Sets up bubbling if needed.
bubble.bind(this, eventName);
return canEvent.addEventListener.apply(this, arguments);
};
// ### unbind
// Stops listening to an event.
// If this is the last listener of a computed property,
// stop forwarding events of the computed property to this map.
Map.prototype.removeEventListener = function (eventName, handler) {
var computedBinding = this._computedAttrs && this._computedAttrs[eventName];
if (computedBinding) {
if (computedBinding.count === 1) {
computedBinding.count = 0;
canReflect.offValue(computedBinding.compute, computedBinding.handler);
} else {
computedBinding.count--;
}
}
// Teardown bubbling if needed.
bubble.unbind(this, eventName);
return canEvent.removeEventListener.apply(this, arguments);
};
// ### etc

@@ -636,0 +629,0 @@ // Setup on/off aliases

{
"name": "can-map",
"version": "4.0.0-pre.5",
"version": "4.0.0-pre.6",
"description": "Observable Objects",

@@ -5,0 +5,0 @@ "homepage": "http://canjs.com",

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