# Lazy

class `Util.``Lazy`()

  This is used to delay the evaluation of a value.

  Evaluation is completely deferred until `get()` is called. Evaluation happens no more than once and the obtained value is cached for later calls to `get()`.

  Example:

      const x = Lazy.create(() => {
          console.log("evaluating (x)")
          return 5;
      });
      console.log("created (x)");
      console.log(`(x) is ${x.get()}`);
      console.log(`(x+1) is ${x.get()+1}`);

      // *** Console Output ***
      // created (x)
      // evaluating (x)
      // (x) is 5
      // (x+1) is 6

  Note: Unlike `LazyObject<T>`, this can have any type `T`.

  ## Index

  Properties

  - `__Lazy`

  Methods

  - `get`
  - `create`

## Properties

`Util.Lazy.``__Lazy`

  readonly

  __Lazy: PhantomMember

## Methods

`Util.Lazy.``get`()
  get(): T

  Forces the lazy value given at construction and returns it.

  Returns: T

`static Util.Lazy.``create`()

  static

  create(value: () => T): `Lazy`<T>

  Creates a new lazy value, which is the result of the supplied function once the lazy value is forced.

  Parameters

  > value: () => T

  Returns: `Lazy`<T>

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Visualize Web or choose a sample question below to start a conversation:

What is HOOPS Visualize Web?
What are the latest release notes for HOOPS Visualize Web?
How do I start evaluating HOOPS Visualize Web?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...