@boost/event
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -6,2 +6,14 @@ # Change Log | ||
## 1.3.0 - 2020-02-04 | ||
#### 🚀 Updates | ||
- Add more internal debugging. (#74) ([70c42c8](https://github.com/milesj/boost/commit/70c42c8)), closes [#74](https://github.com/milesj/boost/issues/74) | ||
**Note:** Version bump only for package @boost/event | ||
### 1.2.1 - 2020-01-25 | ||
@@ -8,0 +20,0 @@ |
@@ -7,2 +7,3 @@ "use strict"; | ||
const BaseEvent_1 = __importDefault(require("./BaseEvent")); | ||
const constants_1 = require("./constants"); | ||
class BailEvent extends BaseEvent_1.default { | ||
@@ -15,2 +16,3 @@ /** | ||
emit(args, scope) { | ||
constants_1.debug('Emitting "%s%s" as bail', this.name, scope ? `:${scope}` : ''); | ||
return Array.from(this.getListeners(scope)).some(listener => listener(...args) === false); | ||
@@ -17,0 +19,0 @@ } |
@@ -9,2 +9,3 @@ "use strict"; | ||
this.name = this.validateName(name, 'name'); | ||
constants_1.debug('New %S created: %s', this.constructor.name, name); | ||
} | ||
@@ -43,2 +44,3 @@ /** | ||
listen(listener, scope) { | ||
constants_1.debug('Registering "%s" listener', this.name); | ||
this.getListeners(scope).add(this.validateListener(listener)); | ||
@@ -62,2 +64,3 @@ return this; | ||
unlisten(listener, scope) { | ||
constants_1.debug('Unregistering "%s" listener', this.name); | ||
this.getListeners(scope).delete(listener); | ||
@@ -64,0 +67,0 @@ return this; |
@@ -7,2 +7,3 @@ "use strict"; | ||
const BaseEvent_1 = __importDefault(require("./BaseEvent")); | ||
const constants_1 = require("./constants"); | ||
class ConcurrentEvent extends BaseEvent_1.default { | ||
@@ -14,2 +15,3 @@ /** | ||
emit(args, scope) { | ||
constants_1.debug('Emitting "%s%s" as concurrent', this.name, scope ? `:${scope}` : ''); | ||
return Promise.all(Array.from(this.getListeners(scope)).map(listener => listener(...args))); | ||
@@ -16,0 +18,0 @@ } |
@@ -0,3 +1,5 @@ | ||
/// <reference types="debug" /> | ||
export declare const debug: import("debug").Debugger; | ||
export declare const WILDCARD_SCOPE = "*"; | ||
export declare const EVENT_NAME_PATTERN: RegExp; | ||
//# sourceMappingURL=constants.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const internal_1 = require("@boost/internal"); | ||
exports.debug = internal_1.createInternalDebugger('event'); | ||
exports.WILDCARD_SCOPE = '*'; | ||
exports.EVENT_NAME_PATTERN = /^[a-z]{1}[-.a-z0-9]*[a-z]{1}$/u; |
@@ -7,2 +7,3 @@ "use strict"; | ||
const BaseEvent_1 = __importDefault(require("./BaseEvent")); | ||
const constants_1 = require("./constants"); | ||
class WaterfallEvent extends BaseEvent_1.default { | ||
@@ -14,2 +15,3 @@ /** | ||
emit(arg, scope) { | ||
constants_1.debug('Emitting "%s%s" as waterfall', this.name, scope ? `:${scope}` : ''); | ||
return Array.from(this.getListeners(scope)).reduce((nextValue, listener) => listener(nextValue), arg); | ||
@@ -16,0 +18,0 @@ } |
{ | ||
"name": "@boost/event", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "A type-safe event system. Designed for Boost applications.", | ||
@@ -23,3 +23,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@boost/internal": "^1.0.3" | ||
"@boost/internal": "^1.1.0" | ||
}, | ||
@@ -35,3 +35,3 @@ "tsconfig": { | ||
}, | ||
"gitHead": "415de2e011ad6252dde167d5e4c8a93d3719ea83" | ||
"gitHead": "3c0a3aabc8de08093f34daaa4fbad3b42a7609db" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21646
288
Updated@boost/internal@^1.1.0