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

appolo-event-dispatcher

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appolo-event-dispatcher - npm Package Compare versions

Comparing version 7.0.1 to 7.0.2

4

lib/event.js

@@ -11,4 +11,4 @@ "use strict";

}
on(fn, scope) {
this._dispatcher.on(this.EVENT_NAME, fn, scope, this._opts);
on(fn, scope, options = {}) {
this._dispatcher.on(this.EVENT_NAME, fn, scope, Object.assign(Object.assign({}, options), this._opts));
}

@@ -15,0 +15,0 @@ un(fn, scope) {

@@ -9,3 +9,3 @@ "use strict";

constructor(private readonly _opts?: { await?: boolean, parallel?: boolean }) {
constructor(private readonly _opts?: IEventOptions) {

@@ -20,4 +20,4 @@ this._opts = Object.assign({}, {await: false, parallel: true}, _opts)

public on(fn: (payload: T) => any, scope?: any): void {
this._dispatcher.on(this.EVENT_NAME, fn, scope, this._opts)
public on(fn: (payload: T) => any, scope?: any,options: IEventOptions = {}): void {
this._dispatcher.on(this.EVENT_NAME, fn, scope, {...options, ...this._opts})
}

@@ -29,3 +29,3 @@

public once(fn?: (payload: T) => any, scope?: any, options: { timeout?: number } = {}): Promise<any> | void {
public once(fn?: (payload: T) => any, scope?: any, options: IEventOptions = {}): Promise<any> | void {
return this._dispatcher.once(this.EVENT_NAME, fn, scope, {...options, ...this._opts});

@@ -32,0 +32,0 @@ }

@@ -21,3 +21,3 @@ "use strict";

if (!handler) {
handler = this[CallbacksSymbol][event] = { callbacks: [], isRoutingKey: false };
handler = this[CallbacksSymbol][event] = { callbacks: [], isRoutingKey: false, order: false };
}

@@ -27,4 +27,7 @@ handler.callbacks.unshift({

scope: scope,
options: Object.assign({ await: false, parallel: true }, this._eventDispatcherOptions, options)
options: Object.assign({ await: false, parallel: true, order: 0 }, this._eventDispatcherOptions, options)
});
if (options && options.order) {
handler.callbacks.sort((a, b) => a.options.order - b.options.order);
}
if (!handler.isRoutingKey && routingKey_1.RoutingKey.isRoutingRoute(event)) {

@@ -31,0 +34,0 @@ if (!this[RoutingKeysSymbol]) {

@@ -32,3 +32,3 @@ "use strict";

if (!handler) {
handler = this[CallbacksSymbol][event] = {callbacks: [], isRoutingKey: false};
handler = this[CallbacksSymbol][event] = {callbacks: [], isRoutingKey: false, order: false};
}

@@ -39,5 +39,9 @@

scope: scope,
options: Object.assign({await: false, parallel: true}, this._eventDispatcherOptions, options)
options: Object.assign({await: false, parallel: true, order: 0}, this._eventDispatcherOptions, options)
});
if (options && options.order) {
handler.callbacks.sort((a, b) => a.options.order - b.options.order)
}
if (!handler.isRoutingKey && RoutingKey.isRoutingRoute(event)) {

@@ -44,0 +48,0 @@ if (!this[RoutingKeysSymbol]) {

@@ -5,3 +5,4 @@ export interface IEventOptions {

parallel?: boolean
timeout?: number
timeout?: number,
order?: number
}

@@ -22,5 +23,5 @@

export interface IDispacherOptions {
export interface IDispatcherOptions {
await?: boolean,
parallel?: boolean
}

@@ -23,3 +23,3 @@ {

"main": "./index.js",
"version": "7.0.1",
"version": "7.0.2",
"license": "MIT",

@@ -26,0 +26,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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