UNPKG

ccxt

Version:

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

40 lines (37 loc) 1.26 kB
// ---------------------------------------------------------------------------- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code // EDIT THE CORRESPONDENT .ts FILE INSTEAD /** * Events allow for applications to use the observer pattern, which * allows subscribing and publishing events, outside the normal * execution paths. * * @_section api/utils/events:Events [about-events] */ import { defineProperties } from "./properties.js"; /** * When an [[EventEmitterable]] triggers a [[Listener]], the * callback always ahas one additional argument passed, which is * an **EventPayload**. */ export class EventPayload { #listener; /** * Create a new **EventPayload** for %%emitter%% with * the %%listener%% and for %%filter%%. */ constructor(emitter, listener, filter) { this.#listener = listener; defineProperties(this, { emitter, filter }); } /** * Unregister the triggered listener for future events. */ async removeListener() { if (this.#listener == null) { return; } await this.emitter.off(this.filter, this.#listener); } }