UNPKG

typescript-dotnet-events

Version:

Basic events/dispatching library. Part of the TypeScript.NET-Core libraries.

19 lines (18 loc) 768 B
/*! * @author electricessence / https://github.com/electricessence/ * Based on Netjs mscorlib.ts * Licensing: MIT https://github.com/electricessence/TypeScript.NET-Core/blob/master/LICENSE.md */ import IDisposable from "typescript-dotnet-core/Disposable/IDisposable"; /** * A simple event dispatcher provided as an alternative to built-in event. * If just dispatching a payload to a uniform set of functions, it may be better to just use the utilities in System/Collections/Array/Dispatch. */ export default class EventSimple<T extends Function> implements IDisposable { private readonly _listeners; add(listener: T): void; remove(listener: T): void; dispatch(...params: any[]): void; toMulticastFunction(): Function; dispose(): void; }