···11-open Wonka_types;
22-33-/* -- source factories */
44-55-/* Accepts an event listening start function and stop function
66- and creates a listenable source that emits the received events.
77- This stream will emit values indefinitely until it receives an
88- End signal from a talkback passed downwards to its sink, which
99- calls the stop function using the internal handler.
1010- This works well for Dom event listeners, for example the ones
1111- in bs-webapi-incubator:
1212- https://github.com/reasonml-community/bs-webapi-incubator/blob/master/src/dom/events/EventTargetRe.re
1313- */
1414-let fromListener:
1515- (
1616- ('event => unit) => unit,
1717- ('event => unit) => unit,
1818- sinkT('event)
1919- ) =>
2020- unit;
2121-2222-/* Accepts a Dom.element type and an event nme and creates a listenable
2323- source that emits values of the Dom.event type. This stream is
2424- created using the fromListener helper and more specific events
2525- should be created using the methods in bs-webapi-incubator:
2626- https://github.com/reasonml-community/bs-webapi-incubator/blob/master/src/dom/events/EventTargetRe.re
2727- */
2828-let fromDomEvent: (Dom.element, string, sinkT(Dom.event)) => unit;
2929-3030-/* Accepts a period in milliseconds and creates a listenable source
3131- that emits ascending numbers for each time the interval fires.
3232- This stream will emit values indefinitely until it receives an
3333- End signal from a talkback passed downwards to its sink. */
3434-let interval: (int, sinkT(int)) => unit;
3535-3636-/* Accepts a JS promise and creates a listenable source that emits
3737- the promise's value once it resolves.
3838- This stream will wait for the promise's completion, unless it
3939- receives an End signal first. */
4040-let fromPromise: (Js.Promise.t('a), sinkT('a)) => unit;
4141-4242-/* -- operators */
4343-4444-/* Takes a projection to a period in milliseconds and a source, and creates
4545- a listenable source that emits the last emitted value if no other value
4646- has been emitted during the passed debounce period. */
4747-let debounce: ((.'a) => int, sourceT('a), sinkT('a)) => unit;
4848-4949-/* Takes a projection to a period in milliseconds and a source, and creates
5050- a listenable source that ignores values after the last emitted value for
5151- the duration of the returned throttle period. */
5252-let throttle: ((.'a) => int, sourceT('a), sinkT('a)) => unit;
5353-5454-/* Takes a notifier source and an input source, and creates a sink & source.
5555- When the notifier emits a value, it will emit the value that it most recently
5656- received from the input source, unless said source hasn't emitted anything
5757- since the last signal. */
5858-let sample: (sourceT('a), sourceT('b), sinkT('b)) => unit;
5959-6060-/* Takes a projection to a period in milliseconds and a source, and creates
6161- a listenable source that delays every emission by that passed period. */
6262-let delay: (int, sourceT('a), sinkT('a)) => unit;
6363-6464-/* Converts a stream into a promise by resolving to the last value of the
6565- stream. */
6666-let toPromise: sourceT('a) => Js.Promise.t('a);
+3
src/web/wonka_operator_debounce.d.ts
···11+import { Operator } from '../wonka_types';
22+33+export const debounce: <A>(f: (x: A) => number) => Operator<A, A>;
···11-open Wonka_types;
22-33-module Types = Wonka_types;
44-55-/* -- subject factory */
66-77-let makeSubject: unit => subjectT('a);
88-99-/* -- source factories */
1010-1111-/* When constructed, calls a function that receives an observer
1212- and creates a push-based stream of events. This is useful
1313- for constructing any kind of asynchronous stream. The return
1414- callback from the passed observer function will be called when
1515- the stream is closed or ends */
1616-let make: ((.observerT('a)) => teardownT, sinkT('a)) => unit;
1717-1818-/* Accepts a list and creates a pullable source for that list.
1919- The source will emit events when being pulled until the list
2020- is exhausted and it completes */
2121-let fromList: (list('a), sinkT('a)) => unit;
2222-2323-/* Accepts an array and creates a pullable source for that array.
2424- The source will emit events when being pulled until the array
2525- is exhausted and it completes */
2626-let fromArray: (array('a), sinkT('a)) => unit;
2727-2828-/* Accepts a value and creates a pullable source emitting just
2929- that single value. */
3030-let fromValue: ('a, sinkT('a)) => unit;
3131-3232-/* A source that ends immediately */
3333-let empty: (sinkT('a)) => unit;
3434-3535-/* A source that never ends or emits a value */
3636-let never: (sinkT('a)) => unit;
3737-3838-/* -- operators */
3939-4040-/* Takes a callback and a source, and creates a sink & source.
4141- The callback will be called for each value that it receives */
4242-let tap: ((.'a) => unit, sourceT('a), sinkT('a)) => unit;
4343-4444-/* Takes a mapping function from one type to another, and a source,
4545- and creates a sink & source.
4646- All values that it receives will be transformed using the mapping
4747- function and emitted on the new source */
4848-let map: ((.'a) => 'b, sourceT('a), sinkT('b)) => unit;
4949-5050-/* Takes a predicate function returning a boolean, and a source,
5151- and creates a sink & source.
5252- All values that it receives will be filtered using the predicate,
5353- and only truthy values will be passed on to the new source.
5454- The sink will attempt to pull a new value when one was filtered. */
5555-let filter: ((.'a) => bool, sourceT('a), sinkT('a)) => unit;
5656-5757-/* Takes a reducer function, a seed value, and a source, and creates
5858- a sink & source.
5959- The last returned value from the reducer function (or the seed value
6060- initially) will be passed to the reducer together with the value
6161- that the sink receives. All return values of the reducer function
6262- are emitted on the new source. */
6363-let scan: (('b, 'a) => 'b, 'b, sourceT('a), sinkT('b)) => unit;
6464-6565-/* Takes a mapping function from one types to a source output,
6666- and a source, and creates a sink & source.
6767- The mapping function is called with each value it receives and
6868- the resulting inner source is merged into the output source. */
6969-let mergeMap: ((.'a) => sourceT('b), sourceT('a), sinkT('b)) => unit;
7070-7171-/* Takes a mapping function from one types to a source output,
7272- and a source, and creates a sink & source.
7373- The mapping function is called with each value it receives and
7474- the latest inner source is merged into the output source. When
7575- a new value comes in the previous source is dicarded. */
7676-let switchMap: ((.'a) => sourceT('b), sourceT('a), sinkT('b)) => unit;
7777-7878-/* Takes a mapping function from one types to a source output,
7979- and a source, and creates a sink & source.
8080- The mapping function is called with each value it receives and
8181- the resulting inner sources are subscribed to and piped through
8282- to the output source in order. */
8383-let concatMap: ((.'a) => sourceT('b), sourceT('a), sinkT('b)) => unit;
8484-8585-/* Takes an array of sources and creates a sink & source.
8686- All values that the sink receives from all sources will be passed through
8787- to the new source. */
8888-let merge: (array(sourceT('a)), sinkT('a)) => unit;
8989-9090-/* Takes an array of sources and creates a sink & source.
9191- The values from each sources will be emitted on the sink, one after another.
9292- When one source ends, the next one will start. */
9393-let concat: (array(sourceT('a)), sinkT('a)) => unit;
9494-9595-/* Works the same as mergeMap but as an operator on a source
9696- of nested sources. */
9797-let mergeAll: (sourceT(sourceT('a)), sinkT('a)) => unit;
9898-let flatten: (sourceT(sourceT('a)), sinkT('a)) => unit;
9999-100100-/* Works the same as concatMap but as an operator on a source
101101- of nested sources. */
102102-let concatAll: (sourceT(sourceT('a)), sinkT('a)) => unit;
103103-104104-/* Takes a listenable or a pullable source and creates a new source that
105105- will ensure that the source is shared between all sinks that follow.
106106- Essentially the original source will only be created once. */
107107-let share: (sourceT('a), sinkT('a)) => unit;
108108-109109-/* Takes two sources and creates a new source & sink.
110110- All latest values from both sources will be passed through as a
111111- tuple of the last values that have been observed */
112112-let combine: (sourceT('a), sourceT('b), sinkT(('a, 'b))) => unit;
113113-114114-/* Takes a max number and a source, and creates a sink & source.
115115- It will emit values that the sink receives until the passed maximum number
116116- of values is reached, at which point it will end the source and the
117117- returned, new source. */
118118-let take: (int, sourceT('a), sinkT('a)) => unit;
119119-120120-/* Takes a max number and a source, and creates a sink & source.
121121- It will pull values and add them to a queue limiting its size to the passed
122122- number until the source ends. It will then proceed to emit
123123- the cached values on the new source as a pullable. */
124124-let takeLast: (int, sourceT('a), sinkT('a)) => unit;
125125-126126-/* Takes a predicate and a source, and creates a sink & source.
127127- It will emit values that the sink receives until the predicate returns false
128128- for a value, at which point it will end the source and the returned, new
129129- source. */
130130-let takeWhile: ((.'a) => bool, sourceT('a), sinkT('a)) => unit;
131131-132132-/* Takes a notifier source and an input source, and creates a sink & source.
133133- It will not emit values that the sink receives until the notifier source
134134- It will emit values that the sink receives until the notifier source
135135- emits a value, at which point it will end the source and the returned, new
136136- source. */
137137-let takeUntil: (
138138- sourceT('a),
139139- sourceT('b),
140140- sinkT('b)
141141-) => unit;
142142-143143-/* Takes a number and a source, and creates a sink & source.
144144- It will not emit values that the sink receives until the passed number
145145- of values is reached, at which point it will start acting like a noop
146146- operator, passing through every signal. */
147147-let skip: (int, sourceT('a), sinkT('a)) => unit;
148148-149149-/* Takes a predicate and a source, and creates a sink & source.
150150- It will not emit values that the sink receives until the passed predicate
151151- returns false for a value, at which point it will start acting like a noop
152152- operator, passing through every signal. */
153153-let skipWhile: ((.'a) => bool, sourceT('a), sinkT('a)) => unit;
154154-155155-/* Takes a notifier source and an input source, and creates a sink & source.
156156- It will not emit values that the sink receives until the notifier source
157157- emits a value, at which point it will start acting like a noop
158158- operator, passing through every signal. */
159159-let skipUntil: (sourceT('a), sourceT('b), sinkT('b)) => unit;
160160-161161-/* -- sink factories */
162162-163163-/* Accepts a source and returns a subscription, but does otherwise not surface values */
164164-let publish: sourceT('a) => subscriptionT;
165165-166166-/* Takes a function and a source, and creates a sink.
167167- The function will be called for each value that the sink receives.
168168- The sink will attempt to pull new values as values come in, until
169169- the source ends. */
170170-let forEach: ((.'a) => unit, sourceT('a)) => unit;
171171-172172-/* Similar to the `forEach` sink factory, but returns an anonymous function
173173- that when called will end the stream immediately.
174174- Ending the stream will propagate an End signal upwards to the root source. */
175175-let subscribe: ((.'a) => unit, sourceT('a)) => subscriptionT;