Added args option for chaining
This commit is contained in:
@ -1899,8 +1899,8 @@ export class UserAPI {
|
|||||||
// =============================================================
|
// =============================================================
|
||||||
|
|
||||||
register = (name: string, operation: EventOperation<AbstractEvent>): void => {
|
register = (name: string, operation: EventOperation<AbstractEvent>): void => {
|
||||||
AbstractEvent.prototype[name] = function (this: AbstractEvent) {
|
AbstractEvent.prototype[name] = function (this: AbstractEvent, ...args: any[]) {
|
||||||
return operation(this);
|
return operation(this, ...args);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import {
|
|||||||
safeScale
|
safeScale
|
||||||
} from "zifferjs";
|
} from "zifferjs";
|
||||||
|
|
||||||
export type EventOperation<T> = (instance: T) => void;
|
export type EventOperation<T> = (instance: T, ...args: any[]) => void;
|
||||||
|
|
||||||
export interface AbstractEvent {
|
export interface AbstractEvent {
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
|
|||||||
Reference in New Issue
Block a user