@typescript-package/history
Version:
A lightweight TypeScript package for tracking the history of values.
56 lines (55 loc) • 1.87 kB
TypeScript
import { Data, DataCore, DataConstructorInput } from '@typescript-package/data';
import { HistoryCurrent } from '../core';
/**
* @description
* @export
* @class CurrentHistory
* @template Value
* @template {DataCore<readonly Value[]>} [DataType=Data<readonly Value[]>]
* @extends {HistoryCurrent<Value, DataType>}
*/
export declare class CurrentHistory<Value, DataType extends DataCore<readonly Value[]> = Data<readonly Value[]>> extends HistoryCurrent<Value, DataType> {
/**
* @description Returns the `string` tag representation of the `CurrentHistory` class when used in `Object.prototype.toString.call(instance)`.
* @public
* @readonly
* @type {string}
*/
get [Symbol.toStringTag](): string;
/**
* @description The current history value.
* @public
* @readonly
* @type {Value}
*/
get value(): Value;
/**
* Creates an instance of `CurrentHistory`.
* @constructor
* @param {{value?: Value}} [param0={}] THe object with current `value`.
* @param {Value} param0.value The current value inside the object.
* @param {?DataConstructorInput<Value, DataType>} [data] Custom data holder.
*/
constructor({ value }?: {
value?: Value;
}, data?: DataConstructorInput<readonly Value[], DataType>);
/**
* @description Destroys the history of this instance.
* @public
* @returns {this} The `this` current instance.
*/
destroy(): this;
/**
* @description Checks whether the current value is set.
* @public
* @returns {boolean} Indicates whether instance has set the current value.
*/
has(): boolean;
/**
* @description Updates a current value.
* @public
* @param {Value} value The current value.
* @returns {this} The `this` current instance.
*/
update(value: Value): this;
}