Class Lazy<T>

Wraps a function that returns a real value to work with when an action is triggered. ALl actions exported by this module (act, call, set, del) recognise instances of this type. This removes the need to hold references to concrete objects before-hand, which may be memory-inneficient.

Example

import { Lazy, set } from 'apption';
const element = document.querySelector('ul');
const lazy = new Lazy((value, index) => element.children[index]);
set({ className: lazy }, 'color-primary', 0);
for (let i = 1; i < element.children.length; i++) set({ className: lazy }, '', i)

Type Parameters

  • T

Constructors

Properties

Methods

Constructors

  • Type Parameters

    • T

    Parameters

    • callable: ICallable

    Returns Lazy<T>

Properties

callable: ICallable

Methods

  • Parameters

    • Rest ...args: any[]

    Returns T