can-dom-events
Advanced tools
Comparing version 1.3.11 to 1.3.12
@@ -69,1 +69,19 @@ var unit = require('steal-qunit'); | ||
}); | ||
unit.test('checks if custom event is already registered (#72)', function (assert) { | ||
var eventType = 'boi'; | ||
var exampleEvent = { | ||
defaultEventType: eventType, | ||
addEventListener: function () {}, | ||
removeEventListener: function () {} | ||
}; | ||
var registry = makeEventRegistry(); | ||
assert.equal(registry.has(eventType), false, 'initial registry should not have the event'); | ||
registry.add(exampleEvent, eventType); | ||
assert.equal(registry.has(eventType), true, 'updated registry should have the event'); | ||
// In production, an Error is thrown | ||
assert.equal(registry.add(exampleEvent, eventType), undefined, 'returns undefined if an event is already registered in development'); | ||
}); |
'use strict'; | ||
var dev = require('can-log/dev/dev'); | ||
function EventRegistry () { | ||
@@ -90,2 +92,7 @@ this._registry = {}; | ||
if (this.has(eventType)) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
dev.warn('Event "' + eventType + '" is already registered'); | ||
return; | ||
} | ||
throw new Error('Event "' + eventType + '" is already registered'); | ||
@@ -92,0 +99,0 @@ } |
{ | ||
"name": "can-dom-events", | ||
"description": "Listen for native and custom DOM events", | ||
"version": "1.3.11", | ||
"version": "1.3.12", | ||
"author": { | ||
@@ -16,2 +16,3 @@ "name": "Chris Andrejewski", | ||
"can-key-tree": "^1.0.0", | ||
"can-log": "^1.0.2", | ||
"can-namespace": "^1.0.0", | ||
@@ -22,2 +23,3 @@ "can-reflect": "^1.11.1" | ||
"detect-cyclic-packages": "^1.1.0", | ||
"done-serve": "^2.3.0", | ||
"fixpack": "^2.3.1", | ||
@@ -48,2 +50,3 @@ "jquery": "^3.2.1", | ||
"detect-cycle": "detect-cyclic-packages --ignore done-serve", | ||
"develop": "done-serve --static --develop --port 8080", | ||
"jshint": "jshint ./*.js ./helpers/*.js --config", | ||
@@ -53,2 +56,6 @@ "lint": "fixpack && npm run jshint", | ||
"preversion": "npm test && npm run build", | ||
"release:major": "npm version major && npm publish", | ||
"release:minor": "npm version minor && npm publish", | ||
"release:patch": "npm version patch && npm publish", | ||
"release:pre": "npm version prerelease && npm publish --tag pre", | ||
"test": "npm run detect-cycle && npm run lint && npm run testee", | ||
@@ -55,0 +62,0 @@ "testee": "testee test.html --browsers firefox" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96797
36
2205
5
9
4
2
+ Addedcan-log@^1.0.2
+ Addedcan-log@1.0.2(transitive)