@boost/event
Advanced tools
Comparing version 2.3.0 to 2.3.1
@@ -6,2 +6,14 @@ # Change Log | ||
### 2.3.1 - 2021-02-08 | ||
#### 📦 Dependencies | ||
- **[packemon]** Update to v0.11. ([20a54dc](https://github.com/milesj/boost/commit/20a54dc)) | ||
**Note:** Version bump only for package @boost/event | ||
## 2.3.0 - 2021-01-16 | ||
@@ -8,0 +20,0 @@ |
@@ -1,3 +0,7 @@ | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
// Generated with Packemon: https://packemon.dev | ||
// Platform: browser, Support: stable, Format: esm | ||
import { createInternalDebugger, createScopedError } from '@boost/internal'; | ||
@@ -13,3 +17,3 @@ var WILDCARD_SCOPE = '*'; | ||
var BaseEvent = function () { | ||
var BaseEvent = /*#__PURE__*/function () { | ||
function BaseEvent(name) { | ||
@@ -24,3 +28,7 @@ this.listeners = new Map(); | ||
} | ||
/** | ||
* Remove all listeners from the event. | ||
*/ | ||
var _proto = BaseEvent.prototype; | ||
@@ -36,3 +44,7 @@ | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Return a set of listeners for a specific event scope. | ||
*/ | ||
; | ||
@@ -47,7 +59,15 @@ _proto.getListeners = function getListeners(scope) { | ||
return this.listeners.get(key); | ||
}; | ||
} | ||
/** | ||
* Return a list of all scopes with listeners. | ||
*/ | ||
; | ||
_proto.getScopes = function getScopes() { | ||
return Array.from(this.listeners.keys()); | ||
}; | ||
} | ||
/** | ||
* Register a listener to the event. | ||
*/ | ||
; | ||
@@ -65,3 +85,7 @@ _proto.listen = function listen(listener, scope) { | ||
}; | ||
}; | ||
} | ||
/** | ||
* Register a listener to the event that only triggers once. | ||
*/ | ||
; | ||
@@ -80,3 +104,7 @@ _proto.once = function once(listener, scope) { | ||
return this.listen(handler, scope); | ||
}; | ||
} | ||
/** | ||
* Remove a listener from the event. | ||
*/ | ||
; | ||
@@ -90,3 +118,7 @@ _proto.unlisten = function unlisten(listener, scope) { | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Validate the listener is a function. | ||
*/ | ||
; | ||
@@ -101,3 +133,7 @@ _proto.validateListener = function validateListener(listener) { | ||
return listener; | ||
}; | ||
} | ||
/** | ||
* Validate the name/scope match a defined pattern. | ||
*/ | ||
; | ||
@@ -116,3 +152,7 @@ _proto.validateName = function validateName(name, type) { | ||
return name; | ||
}; | ||
} | ||
/** | ||
* Emit the event by executing all scoped listeners with the defined arguments. | ||
*/ | ||
; | ||
@@ -122,3 +162,3 @@ return BaseEvent; | ||
var BailEvent = function (_BaseEvent) { | ||
var BailEvent = /*#__PURE__*/function (_BaseEvent) { | ||
_inheritsLoose(BailEvent, _BaseEvent); | ||
@@ -132,2 +172,7 @@ | ||
/** | ||
* Synchronously execute listeners with the defined arguments. | ||
* If a listener returns `false`, the loop with be aborted early, | ||
* and the emitter will return `true` (for bailed). | ||
*/ | ||
_proto2.emit = function emit(args, scope) { | ||
@@ -146,3 +191,3 @@ if (process.env.NODE_ENV !== "production") { | ||
var ConcurrentEvent = function (_BaseEvent2) { | ||
var ConcurrentEvent = /*#__PURE__*/function (_BaseEvent2) { | ||
_inheritsLoose(ConcurrentEvent, _BaseEvent2); | ||
@@ -156,2 +201,6 @@ | ||
/** | ||
* Asynchronously execute listeners for with the defined arguments. | ||
* Will return a promise with an array of each listener result. | ||
*/ | ||
_proto3.emit = function emit(args, scope) { | ||
@@ -170,3 +219,3 @@ if (process.env.NODE_ENV !== "production") { | ||
var Event = function (_BaseEvent3) { | ||
var Event = /*#__PURE__*/function (_BaseEvent3) { | ||
_inheritsLoose(Event, _BaseEvent3); | ||
@@ -180,2 +229,5 @@ | ||
/** | ||
* Synchronously execute listeners with the defined arguments. | ||
*/ | ||
_proto4.emit = function emit(args, scope) { | ||
@@ -190,3 +242,3 @@ Array.from(this.getListeners(scope)).forEach(function (listener) { | ||
var WaterfallEvent = function (_BaseEvent4) { | ||
var WaterfallEvent = /*#__PURE__*/function (_BaseEvent4) { | ||
_inheritsLoose(WaterfallEvent, _BaseEvent4); | ||
@@ -200,2 +252,6 @@ | ||
/** | ||
* Synchronously execute listeners with the defined argument value. | ||
* The return value of each listener will be passed as an argument to the next listener. | ||
*/ | ||
_proto5.emit = function emit(arg, scope) { | ||
@@ -202,0 +258,0 @@ if (process.env.NODE_ENV !== "production") { |
{ | ||
"name": "@boost/event", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"release": "1594765247526", | ||
@@ -12,7 +12,8 @@ "description": "An event system with multiple emitter patterns.", | ||
], | ||
"main": "./lib/index.js", | ||
"main": "./lib/node/index.js", | ||
"module": "./esm/index.js", | ||
"types": "./dts/index.d.ts", | ||
"engines": { | ||
"node": ">=10.3.0" | ||
"node": ">=10.3.0", | ||
"npm": ">=6.1.0" | ||
}, | ||
@@ -30,3 +31,3 @@ "repository": { | ||
"dependencies": { | ||
"@boost/internal": "^2.2.0" | ||
"@boost/internal": "^2.2.1" | ||
}, | ||
@@ -43,3 +44,3 @@ "funding": { | ||
}, | ||
"gitHead": "e2c452ee0c15aa7db91d1945e23ac6951028e672" | ||
"gitHead": "3aa9bda270786e931a90e927375c33dddffed14d" | ||
} |
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
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
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
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
47216
29
696
24
Updated@boost/internal@^2.2.1