mirror of
https://github.com/moroshko/rxviz.git
synced 2026-02-01 17:26:52 +00:00
Add clearInterval to examples
This commit is contained in:
parent
97b7cec38d
commit
b5e1eb6b8d
@ -13,7 +13,7 @@ export default {
|
||||
.create(observer => {
|
||||
let n = 1;
|
||||
|
||||
setInterval(() => {
|
||||
const intervalId = setInterval(() => {
|
||||
if (Math.random() < 0.8 && n < 9) {
|
||||
observer.next(n * n);
|
||||
n += 1;
|
||||
@ -21,6 +21,8 @@ export default {
|
||||
observer.error('Oh no...');
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
return () => clearInterval(intervalId);
|
||||
})
|
||||
`,
|
||||
timeWindow: 10000
|
||||
@ -56,7 +58,7 @@ Rx.Observable.zip(
|
||||
.create(observer => {
|
||||
let secondLast = 1, last = 0;
|
||||
|
||||
setInterval(() => {
|
||||
const intervalId = setInterval(() => {
|
||||
const next = secondLast + last;
|
||||
|
||||
observer.next(next);
|
||||
@ -64,6 +66,8 @@ Rx.Observable.zip(
|
||||
secondLast = last;
|
||||
last = next;
|
||||
}, 1000);
|
||||
|
||||
return () => clearInterval(intervalId);
|
||||
})
|
||||
.delay(100)
|
||||
.groupBy(n => Math.floor(Math.log10(n)))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user