# Function when

- when<TObsv, TPath>(obj, path, callback, options?): IHandle

- Watches the given path on the given object and invokes the callback when the value of the property becomes truthy.

  If the value of the property is already truthy, the callback will be invoked immediately.

  #### Type Parameters

  - TObsv extends Observable
  - TPath extends string

  #### Parameters

  - obj: TObsv

    The object to watch.

  - path: TPath

    The property path to watch.

  - callback: (() => void)

    The callback to invoke when the property becomes truthy.

    - - (): void

      - #### Returns void

  - `Optional` options: WhenOptions

    Optional. The options to use for watching the property.

  #### Returns IHandle

- when<TObsv, TPath>(obj, path, callback, options?): IHandle

- #### Type Parameters

  - TObsv extends Observable
  - TPath extends `${string}.${string}.${string}.${string}`

  #### Parameters

  - obj: TObsv
  - path: TPath
  - callback: (() => void)
    - - (): void

      - #### Returns void

  - `Optional` options: WhenOptions

  #### Returns IHandle