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

can-event-queue

Package Overview
Dependencies
Maintainers
3
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-event-queue - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

21

can-event-queue-test.js

@@ -6,2 +6,3 @@ var QUnit = require('steal-qunit');

var canSymbol = require("can-symbol");
var canReflect = require("can-reflect");

@@ -131,3 +132,3 @@ QUnit.module('can-event-queue',{

QUnit.test("empty unbind", function(){
QUnit.test("handler-less unbind", function(){
var obj = eventQueue({});

@@ -143,3 +144,21 @@

});
QUnit.test("key-less unbind", function(){
var obj = eventQueue({});
obj.addEventListener("first", function(){});
obj.addEventListener("first", function(){},"notify");
obj.addEventListener("second", function(){});
obj.addEventListener("second", function(){},"notify");
canReflect.onKeyValue(obj,"first", function(){});
canReflect.onKeyValue(obj,"first", function(){},"notify");
canReflect.onKeyValue(obj,"second", function(){});
canReflect.onKeyValue(obj,"second", function(){},"notify");
var handlers = obj[canSymbol.for("can.meta")].handlers;
QUnit.equal(handlers.get([]).length, 8, "2 first handlers");
obj.removeEventListener();
QUnit.equal(handlers.get([]).length, 4, "first handlers removed");
});
QUnit.test("@@can.isBound symbol", function() {

@@ -146,0 +165,0 @@ var obj = eventQueue({});

@@ -172,3 +172,11 @@ var canDev = require("can-util/js/dev/dev");

removeEventListener: function(key, handler, queueName) {
if (!handler && !queueName) {
if(key === undefined) {
// This isn't super fast, but this pattern isn't used much.
// We could re-arrange the tree so it would be faster.
var handlers = getHandlers(this);
var keyHandlers = handlers.getNode([]);
Object.keys(keyHandlers).forEach(function(key){
handlers.delete([key,"event"]);
});
} else if (!handler && !queueName) {
getHandlers(this).delete([key, "event"]);

@@ -175,0 +183,0 @@ } else if (!handler) {

@@ -1,2 +0,2 @@

/*can-event-queue@0.4.0#can-event-queue*/
/*can-event-queue@0.4.1#can-event-queue*/
define([

@@ -134,3 +134,12 @@ 'require',

removeEventListener: function (key, handler, queueName) {
if (!handler && !queueName) {
if (key === undefined) {
var handlers = getHandlers(this);
var keyHandlers = handlers.getNode([]);
Object.keys(keyHandlers).forEach(function (key) {
handlers.delete([
key,
'event'
]);
});
} else if (!handler && !queueName) {
getHandlers(this).delete([

@@ -137,0 +146,0 @@ key,

@@ -1,2 +0,2 @@

/*can-event-queue@0.4.0#can-event-queue*/
/*can-event-queue@0.4.1#can-event-queue*/
var canDev = require('can-util/js/dev/dev');

@@ -122,3 +122,12 @@ var assign = require('can-util/js/assign/assign');

removeEventListener: function (key, handler, queueName) {
if (!handler && !queueName) {
if (key === undefined) {
var handlers = getHandlers(this);
var keyHandlers = handlers.getNode([]);
Object.keys(keyHandlers).forEach(function (key) {
handlers.delete([
key,
'event'
]);
});
} else if (!handler && !queueName) {
getHandlers(this).delete([

@@ -125,0 +134,0 @@ key,

@@ -130,3 +130,3 @@ /*[global-shim-start]*/

/*can-event-queue@0.4.0#can-event-queue*/
/*can-event-queue@0.4.1#can-event-queue*/
define('can-event-queue', [

@@ -264,3 +264,12 @@ 'require',

removeEventListener: function (key, handler, queueName) {
if (!handler && !queueName) {
if (key === undefined) {
var handlers = getHandlers(this);
var keyHandlers = handlers.getNode([]);
Object.keys(keyHandlers).forEach(function (key) {
handlers.delete([
key,
'event'
]);
});
} else if (!handler && !queueName) {
getHandlers(this).delete([

@@ -267,0 +276,0 @@ key,

2

package.json
{
"name": "can-event-queue",
"main": "./can-event-queue.js",
"version": "0.4.1",
"version": "0.4.2",
"description": "A event mixin that uses queues to dispatch handlers",

@@ -6,0 +6,0 @@ "homepage": "",

@@ -5,3 +5,5 @@ # can-event-queue

`can-event-queue` mixes in event binding and dispatching methods that use [can-queues](../can-queues).
`can-event-queue` mixes in event binding and dispatching methods that
use [can-queues](../can-queues). This adds legacy binding methods `addEventListener`
and `removeEventListener`. This package should not be used for new packages.

@@ -8,0 +10,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