Added all() method for chaining all events

This commit is contained in:
2023-12-22 15:26:51 +02:00
parent 98f431f6b2
commit 30983147ea
5 changed files with 44 additions and 5 deletions

View File

@ -1955,15 +1955,23 @@ export class UserAPI {
// High Order Functions
// =============================================================
register = (name: string, operation: EventOperation<AbstractEvent>): void => {
register = (name: string, operation: EventOperation<AbstractEvent>): true => {
AbstractEvent.prototype[name] = function(
this: AbstractEvent,
...args: any[]
) {
return operation(this, ...args);
};
return true;
};
all = (operation: EventOperation<AbstractEvent>): true => {
AbstractEvent.prototype.chainAll = function (...args: any[]) {
return operation(this, ...args);
};
return true;
}
public shuffle = <T>(array: T[]): T[] => {
/**
* Returns a shuffled version of an array.