UNPKG

vasille

Version:

The first Developer eXperience Orientated front-end framework (core library).

46 lines (45 loc) 1.24 kB
import { IValue } from "../core/ivalue.js"; export type KindOfIValue<T extends unknown[]> = { [K in keyof T]: IValue<T[K]>; }; /** * Bind some values to one expression * @class Expression * @extends IValue */ export declare class Expression<T, Args extends unknown[]> extends IValue<T> { /** * The array of value which will trigger recalculation * @type {Array} */ private values; /** * Cache the values of expression variables * @type {Array} */ private readonly valuesCache; /** * The function which will be executed on recalculation */ private readonly func; /** * Expression will link different handler for each value of the list */ private linkedFunc; /** * The buffer to keep the last calculated value */ private sync; /** * Creates a function bounded to N values * @param func {Function} the function to bound * @param values * @param link {Boolean} links immediately if true */ constructor(func: (...args: Args) => T, values: KindOfIValue<Args>); get $(): T; set $(value: T); on(handler: (value: T) => void): void; off(handler: (value: T) => void): void; destroy(): void; }