Produces a reactive from the basis of a function. callback is executed, with its result emitted via the returned reactive.
// Produce a random number every second constr = Rx.From.func(Math.random, { interval:1000 });
callback can be called repeatedly by providing the interval option to set the rate of repeat.
Looping can be limited with options.maximumRepeats, or passing a signal options.signal
and then activating it.
// Reactive that emits a random number every second, five times constr1 = Rx.From.func(Math.random, { interval:1000, maximumRepeats:5 }
// Generate a random number every second until ac.abort() is called constac = newAbortController(); constr2 = Rx.From.func(Math.random, { interval:1000, signal:ac.signal });
The third option is for callback to fire the provided abort function.
By default has a laziness of 'very' meaning that callback is run only when there's a subscriber
By default stream closes if callback throws an error. Use options.closeOnError:'ignore' to change.
Produces a reactive from the basis of a function.
callback
is executed, with its result emitted via the returned reactive.callback
can be called repeatedly by providing theinterval
option to set the rate of repeat. Looping can be limited withoptions.maximumRepeats
, or passing a signaloptions.signal
and then activating it.The third option is for
callback
to fire the provided abort function.By default has a laziness of 'very' meaning that
callback
is run only when there's a subscriber By default stream closes ifcallback
throws an error. Useoptions.closeOnError:'ignore'
to change.