Merge pull request #1662 from spacejack/stream-scan-types
Add stream/scan, stream/scanMerge type definitions
This commit is contained in:
commit
dc875fdbd3
1 changed files with 22 additions and 0 deletions
22
mithril.d.ts
vendored
22
mithril.d.ts
vendored
|
|
@ -238,6 +238,18 @@ declare namespace Mithril {
|
|||
/** A special value that can be returned to stream callbacks to halt execution of downstreams. */
|
||||
HALT: any;
|
||||
}
|
||||
|
||||
interface StreamScan {
|
||||
/** Creates a new stream with the results of calling the function on every incoming stream with and accumulator and the incoming value. */
|
||||
<T,U>(fn: (acc: U, value: T) => U, acc: U, stream: Stream<T>): Stream<U>;
|
||||
}
|
||||
|
||||
interface StreamScanMerge {
|
||||
/** Takes an array of pairs of streams and scan functions and merges all those streams using the given functions into a single stream. */
|
||||
<T,U>(pairs: [Stream<T>, (acc: U, value: T) => U][], acc: U): Stream<U>;
|
||||
/** Takes an array of pairs of streams and scan functions and merges all those streams using the given functions into a single stream. */
|
||||
<U>(pairs: [Stream<any>, (acc: U, value: any) => U][], acc: U): Stream<U>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'mithril' {
|
||||
|
|
@ -284,3 +296,13 @@ declare module 'mithril/stream' {
|
|||
const s: Mithril.StreamFactory;
|
||||
export = s;
|
||||
}
|
||||
|
||||
declare module 'mithril/stream/scan' {
|
||||
const s: Mithril.StreamScan;
|
||||
export = s;
|
||||
}
|
||||
|
||||
declare module 'mithril/stream/scanMerge' {
|
||||
const sm: Mithril.StreamScanMerge;
|
||||
export = sm;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue