@most/hold
TypeScript icon, indicating that this package has built-in type declarations

4.1.0 • Public • Published

@most hold()

Deliver the most recently seen event to each new observer the instant it begins observing. A held stream is always multicast.

Note: @most/hold >= 3.0.0 is compatible with @most/core. Use @most/hold 2.x for compatibility with most 1.x.

Install

npm install --save @most/hold

Usage

import { click } from '@most/dom-event'
import { map } from '@most/core'
import { hold } from '@most/hold'

const clickCoords = map(e => ({ x: e.clientX, y: clientY }), click(document))

// start holding on first subscription
const heldCoords = hold(clickCoords)

API

hold :: Stream a → Stream a

Given an input stream:

stream:    -a---b---c---d->

observers which begin observing at different times will see:

observer1: -a---b---c---d->
observer2:    a-b---c---d->
observer3:           c--d->

/@most/hold/

    Package Sidebar

    Install

    npm i @most/hold

    Weekly Downloads

    285

    Version

    4.1.0

    License

    MIT

    Unpacked Size

    16.4 kB

    Total Files

    10

    Last publish

    Collaborators

    • briancavalier
    • davidchase
    • most
    • tylors