Comparing version 2.0.0 to 2.0.1
10
index.js
@@ -20,3 +20,3 @@ const is = require('arc-is'); | ||
setCatchAll(_f){ | ||
if(is(_f) === 'function' || _f === undefined){ | ||
if(is(_f) === 'function' || is(_f) === 'asyncfunction' || _f === undefined){ | ||
this.catchAll = _f; | ||
@@ -34,3 +34,3 @@ } | ||
let heap; | ||
if(is(_listener) !== 'function'){ | ||
if(is(_listener) !== 'function' && is(_listener) !== 'asyncfunction'){ | ||
throw new TypeError('Events.on requires listener to be a callable function'); | ||
@@ -61,3 +61,3 @@ } | ||
onState(_event,_listener){ | ||
if(is(_listener) !== 'function'){ | ||
if(is(_listener) !== 'function' && is(_listener) !== 'asyncfunction'){ | ||
throw new TypeError('Events.onState requires listener to be a callable function'); | ||
@@ -78,3 +78,3 @@ } | ||
once(_event,_listener,_customId){ | ||
if(is(_listener) !== 'function'){ | ||
if(is(_listener) !== 'function' && is(_listener) !== 'asyncfunction'){ | ||
throw new TypeError('Events.once requires listener to be a callable function'); | ||
@@ -90,3 +90,3 @@ } | ||
removeListener(_event,_listener){ | ||
if(is(_listener) !== 'function'){ | ||
if(is(_listener) !== 'function' && is(_listener) !== 'asyncfunction'){ | ||
throw new TypeError('Events.removeListener requires listener to be a callable function') | ||
@@ -93,0 +93,0 @@ } |
{ | ||
"name": "arc-events", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Independent Events class", | ||
@@ -23,5 +23,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"arc-array": "^4.0.1", | ||
"arc-is": "^1.0.5", | ||
"arc-object": "^2.0.0" | ||
"arc-array": "^4.2.0", | ||
"arc-is": "^1.0.6", | ||
"arc-object": "^3.1.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "devDependencies": { |
@@ -118,2 +118,19 @@ "use strict"; | ||
tap.test('ArcEvents.on(async)',function(_test){ | ||
EventTest.clear(); | ||
_test.throws(function(){ | ||
EventTest.on('event','STRING'); | ||
},TypeError); | ||
//Most basic test | ||
EventTest.on('event',async function(_data){ | ||
_test.equal(_data,'DATA'); | ||
_test.end(); | ||
}); | ||
EventTest.emit('event',['DATA']); | ||
}); | ||
tap.test('ArcEvents.once',function(_test){ | ||
@@ -128,3 +145,3 @@ EventTest.clear(); | ||
var counter = 0; | ||
EventTest.once('once',function(){ | ||
@@ -131,0 +148,0 @@ counter++; |
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
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
22079
403
5
+ Addedarc-check@1.2.1(transitive)
+ Addedarc-object@3.1.2(transitive)
+ Addeddeepcopy@2.1.0(transitive)
+ Addedtype-detect@4.1.0(transitive)
- Removedarc-array@4.0.1(transitive)
- Removedarc-check@1.2.0(transitive)
- Removedarc-is@1.0.5(transitive)
- Removedarc-object@2.1.0(transitive)
- Removeddeepcopy@0.6.3(transitive)
Updatedarc-array@^4.2.0
Updatedarc-is@^1.0.6
Updatedarc-object@^3.1.0