Skip to content

Commit

Permalink
Added args option for chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
amiika committed Nov 17, 2023
1 parent ce943aa commit 569f0ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1899,8 +1899,8 @@ export class UserAPI {
// =============================================================

register = (name: string, operation: EventOperation<AbstractEvent>): void => {
AbstractEvent.prototype[name] = function (this: AbstractEvent) {
return operation(this);
AbstractEvent.prototype[name] = function (this: AbstractEvent, ...args: any[]) {
return operation(this, ...args);
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/classes/AbstractEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
safeScale
} from "zifferjs";

export type EventOperation<T> = (instance: T) => void;
export type EventOperation<T> = (instance: T, ...args: any[]) => void;

export interface AbstractEvent {
[key: string]: any
Expand Down

0 comments on commit 569f0ad

Please sign in to comment.