This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver, palette } = require('api/v0.3'); | |
const { from, timer, pipe } = require('rxjs'); | |
const { zip, take, map, mergeMap, switchMap, concatMap, exhaustMap, tap, delayWhen } = require('rxjs/operators'); | |
// our source$ will emit values at 5ms, 10ms, 20ms | |
const source$ = fromDelayed([ 5, 10, 20 ]).pipe( | |
zip(from(palette), Marble) // colorize each item | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver } = require('api/v0.3'); | |
const { timer, throwError, of, NEVER } = require('rxjs'); | |
const { tap, switchMap, concat, retryWhen, take, delay } = require('rxjs/operators'); | |
timer(5).pipe( | |
switchMap(value => { | |
if (Date.now() < 35) { | |
return throwError('Too early!'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver } = require('api/v0.3'); | |
const { Subject, interval, merge } = require('rxjs'); | |
const { timeInterval, filter, distinctUntilChanged, map , pairwise } = require('rxjs/operators'); | |
const START_EVENT = 'RUN'; | |
const END_EVENT = 'END'; | |
const events$ = new Subject(); | |
const result$ = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver } = require('api/v0.3'); | |
const { Subject, interval, merge } = require('rxjs'); | |
const { timeInterval, filter, distinctUntilChanged, map } = require('rxjs/operators'); | |
const START_EVENT = 'RUN'; | |
const END_EVENT = 'END'; | |
const events$ = new Subject(); | |
const result$ = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver, palette } = require('api/v0.3'); | |
const { timer } = require('rxjs'); | |
const { take } = require('rxjs/operators'); | |
const source$ = timer(0, 5).pipe( | |
take(6) | |
); | |
const result$ = source$.pipe( | |
// add your code here... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver } = require('api/v0.3'); | |
const { timer, NEVER } = require('rxjs'); | |
const { merge, map, tap, take, finalize, retryWhen } = require('rxjs/operators'); | |
const sourceObserver = rxObserver('Source'); | |
const errorsObserver = rxObserver('Errors'); | |
const resultObserver = rxObserver('Result'); | |
timer(10, 10).pipe( | |
map(x => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver, palette } = require('api/v0.3'); | |
const { of, timer } = require('rxjs'); | |
const { retry, switchMap, timeout } = require('rxjs/operators'); | |
let index = 0; | |
const source$ = of(void 0).pipe( | |
switchMap(()=> | |
// 4 attempts | |
timer([20, 20, 20, 5][index++]) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver, palette } = require('api/v0.3'); | |
const { timer, Subject, from, empty } = require('rxjs'); | |
const { takeUntil, take, repeatWhen, filter, zip, map, share } = require('rxjs/operators'); | |
// stream for coloring | |
const palette$ = from(palette); | |
const source$ = timer(0, 10).pipe( | |
take(10), | |
// get color for each item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver, palette } = require('api/v0.3'); | |
const { merge, timer, from } = require('rxjs'); | |
const { map, concatMap, take, zip, ignoreElements, startWith } = require('rxjs/operators'); | |
// stream for coloring | |
const palette$ = from(palette); | |
const source$ = merge( | |
timer(0, 33), | |
timer(5, 17) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { rxObserver, palette } = require('api/v0.3'); | |
const { merge, timer, from, NEVER } = require('rxjs'); | |
const { map, take, zip, auditTime, throttleTime, debounceTime, sampleTime, share, concat } = require('rxjs/operators'); | |
// stream for coloring | |
const palette$ = from(palette); | |
const source$ = merge( | |
timer(0, 330), | |
timer(50, 180) |