AppleSauce
    Preparing search index...

    Function useObservableCallback

    • Returns a callback function and an events Observable.

      When the callback is called, the Observable will emit the first argument of the callback.

      Type Parameters

      • TEvent = void

        Output value of Observable.

      Returns [(event: TEvent) => void, Observable<TEvent>]

    • Returns a callback function and an events Observable.

      When the callback is called, the Observable will emit the first argument of the callback.

      Note: useObservableCallback will call init once and always return the same Observable. It is not safe to access closure (except other Observables) directly inside init. Use ref or [[useObservable]] with withLatestFrom instead.

      Type Parameters

      • TOutput

        Output value within Observable.

      • TInput = TOutput

        Selected values.

      Parameters

      • init: (events$: Observable<TInput>) => Observable<TOutput>

        A pure function that, when applied to an Observable, returns an Observable.

      Returns [(event: TInput) => void, Observable<TOutput>]

    • Returns a callback function and an events Observable.

      When the callback is called, the Observable will emit the first argument of the callback.

      (From v2.1.0) Optionally accepts a selector function that transforms a list of event arguments into a single value.

      Note: useObservableCallback will call init once and always return the same Observable. It is not safe to access closure (except other Observables) directly inside init. Use ref or [[useObservable]] with withLatestFrom instead.

      Type Parameters

      • TOutput = undefined

        Output value within Observable.

      • TInput = TOutput

        Selected values.

      • TParams extends readonly any[] = [TInput]

        A tuple of event callback parameters.

      Parameters

      • init: (events$: Observable<TInput>) => Observable<TOutput>

        A pure function that, when applied to an Observable, returns an Observable.

      • selector: (args: TParams) => TInput

        A function that transforms an array of event arguments into a single value.

      Returns [(...args: TParams) => void, Observable<TOutput>]