Function wrap

  • Wrap a reactive source to allow for chained function calls.

    Example: For every pointerup event on the body, chunk the events over periods of 200ms, get the number of events in that period, and print it out.

    eg. detecting single or double-clicks

    wrap(Rx.fromEvent<{ x: number, y: number }>(document.body, `pointerup`))
    .chunk({ elapsed: 200 })
    .transform(v => v.length)
    .onValue(v => { console.log(v) });

    Type Parameters

    • TIn

    Parameters

    Returns Wrapped<TIn>