UNPKG

@barchart/common-js

Version:
64 lines (63 loc) 1.44 kB
/** * An object that has an end-of-life process. * * @public */ export default class Disposable { /** * Creates and returns a {@link Disposable} object with end-of-life logic * delegated to a function. * * @public * @static * @param {Function} disposeAction * @returns {Disposable} */ public static fromAction(disposeAction: Function): Disposable; /** * Creates and returns a {@link Disposable} object whose end-of-life * logic does nothing. * * @public * @static * @returns {Disposable} */ public static getEmpty(): Disposable; /** * Indicates if the dispose action has been executed. * * @public * @returns {boolean} */ public get disposed(): boolean; /** * Invokes end-of-life logic. Once this function has been * invoked, further interaction with the object is not * recommended. * * @public */ public dispose(): void; /** * @protected * @abstract * @ignore */ protected _onDispose(): void; /** * Returns true if the {@link Disposable#dispose} function has been invoked. * * @public * @deprecated * @returns {boolean} */ public getIsDisposed(): boolean; /** * Returns a string representation. * * @public * @returns {string} */ public toString(): string; #private; }