Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "_helpers/lazy-properties"

Index

Functions

Functions

lazyProperties

  • lazyProperties<T>(target: T, apply: function, keys: Iterable<keyof T>): void
  • Intercepts reads to the provided keys of target to run apply before returning the value. This allows to initialize these properties lazily. You should ensure that apply never throws. Once one of the trapped properties was read, all the properties become normal properties. Call lazyProperties on different subsets of keys to have independent lazy properties.

    Calling lazyProperties multiple time on the same key is undefined behavior.

    Type parameters

    • T

    Parameters

    • target: T

      The object holding the properties to intercept.

    • apply: function

      The function called once one of the lazy properties is accessed. Its this value will be target.

        • (): void
        • Returns void

    • keys: Iterable<keyof T>

      The names of the properties to intercept.

    Returns void

Generated using TypeDoc