How to use the interval function from rxjs
Find comprehensive JavaScript rxjs.interval code examples handpicked from public code repositorys.
GitHub: openforis/sepal
41 42 43 44 45 46 47 48 49 50
), maxRetries }) const monitor$ = taskId => interval(MONITORING_FREQUENCY).pipe( exhaustMap(() => status$(taskId)), switchMap(({state, error_message: error}) => (error || state === FAILED) ? throwError(() => new Error(error))
45
178
34
GitHub: cbartram/Nest
109 110 111 112 113 114 115 116 117 118
}, complete() { onComplete(); }, }; this._latestSnapshotObservable = interval(this._options.snapshotInterval || 5000).pipe( switchMap(() => from(this.getLatestSnapshot())), multicast(new Subject()), refCount(), );
7
18
3
+ 7 other calls in file
GitHub: jsonberry/rxjs-examples
13 14 15 16 17 18 19 20 21 22
} = require('rxjs/operators') const { observer } = require('../utils') // const event = interval(500).pipe(take(3), const event = of('event').pipe( tap(() => console.log('[ side effect ]')), // share(), // publish(),
1
8
2
+ 13 other calls in file
8 9 10 11 12 13 14 15 16 17
// make Observable hot const { interval } = require('rxjs'); const { share, take } = require('rxjs/operators'); const source$ = interval(100).pipe(take(3)); console.log('# without share'); source$.subscribe(v => console.log(`subscriber 1 received: ${v}`)); setTimeout(() => {
1
0
0
+ 12 other calls in file
GitHub: marc2016/TimeTracker
61 62 63 64 65 66 67
return returnValue } } self._timeSignalSource = interval(1000).pipe(map(self._timeUpdate)) self.timeSignal = self._pauser.pipe(switchMap(paused => paused ? never() : self._timeSignalSource))
0
2
4
GitHub: caosbad/api
52 53 54 55 56 57 58 59 60 61
exports.from = rxjs.from; exports.fromEvent = rxjs.fromEvent; exports.fromEventPattern = rxjs.fromEventPattern; exports.generate = rxjs.generate; exports.iif = rxjs.iif; exports.interval = rxjs.interval; exports.merge = rxjs.merge; exports.never = rxjs.never; exports.of = rxjs.of; exports.onErrorResumeNext = rxjs.onErrorResumeNext;
299
0
1
GitHub: openforis/sepal
2 3 4 5 6 7 8 9 10 11 12
const {fileToJson$} = require('./file') const {exec$} = require('./terminal') const {basename} = require('path') const monitorApps = () => interval(5000).pipe( exhaustMap(() => apps$().pipe( concatMap(app => updateApp$(app).pipe( delay(5000) ))
45
177
0
GitHub: thcolin/sensorr
30 31 32 33 34 35 36 37 38 39
this.emit('status', err) } listen() { return of(new PlexService(Config.payload.plex)).pipe( mergeMap((plex) => interval(5000).pipe( mergeMap(() => plex.status()), tap(status => this.state(status)), takeWhile(status => status === 'waiting', true), takeLast(1),
6
98
6
16 17 18 19 20 21 22 23 24
// source stream -- an interval // emitting at 50ms, 100ms, 150ms, 200ms, 250ms, etc // we're taking 3 first values from it const source$ = interval(50) .pipe( take(3) );
10
159
3
22 23 24 25 26 27 28 29 30 31
} reset() { const startDate = addHours(startOfDay(new Date()), this.startHour) const msUpdateFrequency = 100 this.currentTime = interval(msUpdateFrequency).pipe( scan( (acc) => addMilliseconds( acc,
1
16
0
GitHub: AkatQuas/kiddo-plays
39 40 41 42 43 44 45 46 47 48 49 50
} m2(); function m3() { const source = interval(500); const subject = new Subject(); const refCounted = source.pipe(multicast(subject), refCount()); let subscription1, subscription2;
1
1
0
0 1 2 3 4 5 6 7 8 9 10 11 12
const { Subject, interval } = require('rxjs'); const { takeUntil } = require('rxjs/operators'); const pageNavigationSubject$ = new Subject() const observable$ = interval(100) observable$.pipe( takeUntil(pageNavigationSubject$) ).subscribe(() => console.log('100ms have passed'))
1
1
0
GitHub: USU-Robosub/submarine
66 67 68 69 70 71 72 73 74 75
const once = action => system => of(0).pipe(map(() => action(system))) const delayThen = (action, time=1) => system => timer(time).pipe(map(() => action(system))) const repeatWithDelay = (action, time=1) => system => interval(time).pipe(map(() => action(system))) const repeat = action => system => repeatWithDelay(action, 1)(system) const fromPromise = action => system => from(action(system))
0
1
7
+ 5 other calls in file
0 1 2 3 4 5 6 7 8 9 10 11 12
const { Subject, interval } = require('rxjs'); const { skipUntil } = require('rxjs/operators'); const pageNavigationSubject$ = new Subject() const observable$ = interval(500) observable$.pipe( skipUntil(pageNavigationSubject$) ).subscribe(console.log)
1
0
0
42 43 44 45 46 47 48 49 50 51 52
}) return filteredObs$ } var interval$ = fromInterval(500) // var interval$ = interval(500) // var evenNos$ = filterEven(interval$) var evenNos$ = filter(interval$, x => x % 2 == 0) const subscriber = evenNos$.subscribe(val => console.log(val))
1
0
0
GitHub: batovpasha/hypestock
23 24 25 26 27 28 29 30 31 32
// eslint-disable-next-line no-unused-vars return (stockSymbol, keywords = []) => { if (streams[stockSymbol]) return streams[stockSymbol]; streams[stockSymbol] = interval(REQUESTS_INTERVAL).pipe( startWith(0), // starts immediately switchMap(() => fromFetch(`${BASE_API_URL}/${stockSymbol}${HYPES_PATH}/last/50?token=${TOKEN}`) .pipe(switchMap(response => {
1
0
1