Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ See [combine](#combine) for more details.
#### `sampler.sample(f, ...streams) -> Stream`
#### `most.sample(f, sampler, ...streams) -> Stream`

Create a new stream by combining sampled values from many input streams.
Create a new stream by combining sampled values from one or more input streams.

```
s1: -1-----2-----3->
Expand Down
9 changes: 9 additions & 0 deletions type-definitions/most.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export interface Stream<A> extends Source<A> {
await<B>(this: Stream<Promise<B>>): Stream<B>;
awaitPromises<B>(this: Stream<Promise<B>>): Stream<B>;

sample<B, R>(
fn: (b: B) => R,
b: Stream<B>,
): Stream<R>;
sample<B, C, R>(
fn: (b: B, c: C) => R,
b: Stream<B>,
Expand Down Expand Up @@ -339,6 +343,11 @@ export function fromPromise<A>(p: Promise<A>): Stream<A>;
export function await<A>(s: Stream<Promise<A>>): Stream<A>;
export function awaitPromises<A>(s: Stream<Promise<A>>): Stream<A>;

export function sample<A, R>(
fn: (a: A) => R,
sampler: Stream<any>,
a: Stream<A>,
): Stream<R>;
export function sample<A, B, R>(
fn: (a: A, b: B) => R,
sampler: Stream<any>,
Expand Down