Produces an incrementing value. By default starts at 0 and counts forever, incrementing every second.
const r = Rx.From.count();r.onValue(c => { // 0, 1, 2, 3 ... every second}); Copy
const r = Rx.From.count();r.onValue(c => { // 0, 1, 2, 3 ... every second});
The limit is exclusive
limit
const r = Rx.From.count({limit:5});// Yields 0,1,2,3,4 Copy
const r = Rx.From.count({limit:5});// Yields 0,1,2,3,4
If limit is less than start, it will count down instead.
const r = Rx.count({start:5, limit: 0});// Yie:ds 5,4,3,2,1 Copy
const r = Rx.count({start:5, limit: 0});// Yie:ds 5,4,3,2,1
// Count 10, 12, 14 ... every 500msconst r = Rx.From.count({ start: 10, amount: 2, interval: 500 }); Copy
// Count 10, 12, 14 ... every 500msconst r = Rx.From.count({ start: 10, amount: 2, interval: 500 });
In addition to setting limit (which is exclusive), you can stop with an abort signal
const ac = new AbortController();const r = Rx.From.count({signal:ac.signal});...ac.abort(`stop`); Copy
const ac = new AbortController();const r = Rx.From.count({signal:ac.signal});...ac.abort(`stop`);
Produces an incrementing value. By default starts at 0 and counts forever, incrementing every second.
The
limit
is exclusiveIf limit is less than start, it will count down instead.
In addition to setting
limit
(which is exclusive), you can stop with an abort signal