ts-lib-extended
Version:
Additional types and tools for typescript
36 lines (35 loc) • 1 kB
TypeScript
import type { EventArgs } from './args/index.js';
import type { EventSubscription, EventUnsubscription } from './types.js';
/**
* Subscribable listener to certain events
*
* @export
* @class Event
* @template TSender
* @template {EventArgs | void} [TArgs=void]
* @since 1.0.0
*/
export declare class Event<TSender, TArgs extends EventArgs | void = void> {
private _subscription;
constructor(subscribe_: EventSubscription<TSender, TArgs>, unsubscribe_: EventUnsubscription, detachEventProxy_: (detachEvent_: () => void) => void);
/**
* subrcribe to event
*
* @readonly
* @type {EventSubscription<TSender, TArgs>}
* @memberof Event
* @since 1.0.0
*/
get subscribe(): EventSubscription<TSender, TArgs>;
/**
* unsubrcribe from event
*
* @readonly
* @type {EventUnsubscription}
* @memberof Event
* @since 1.0.0
*/
get unsubscribe(): EventUnsubscription;
private validateDetached;
private detach;
}