I hereby claim:
- I am thcolin on github.
- I am thcolin (https://keybase.io/thcolin) on keybase.
- I have a public key ASCbLDHXuxXB_B5j7DpT3CgPvzT8L5qbvRZt16-mWcgmXwo
To claim this, I am signing this object:
| {"lastUpload":"2020-08-10T12:50:56.755Z","extensionVersion":"v3.4.3"} |
I hereby claim:
To claim this, I am signing this object:
| function duno(root, diff, index) { | |
| let dunoed = Object.assign({}, root) | |
| for (let key in diff) { | |
| switch (typeof diff[key]) { | |
| case 'function': | |
| dunoed[key] = diff[key](dunoed[key], dunoed) | |
| break | |
| default: | |
| dunoed[key] = diff[key] |
| import Rx from 'rxjs/Rx' | |
| function delayBetween(delay, first = false){ | |
| let past = Date.now() | |
| return this.mergeMap((next, index) => { | |
| const present = Date.now() | |
| const futur = Math.max(past + (index === 0 && !first ? 0 : delay), present) | |
| past = futur | |
| return Rx.Observable.of(next).delay(futur - present) |
| var promise = Promise.resolve() | |
| var values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
| values.forEach(function(id) { | |
| promise = promise.then(function() { | |
| return new Promise(function(resolve, reject) { | |
| setTimeout(function() { | |
| resolve(id) | |
| }, 2000) | |
| }) |
βββββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ
β βββββββββββββ β βββββββββββββββ βββββββββββββββ βββββββββββββββ
β β 0 β β ββ 0 ββ ββ 0 ββ ββ 1 ββ
β βββββββββββββ β βββββββββββββββ βββββββββββββββ βββββββββββββββ
viewport β β βββββββββββββββ€ βββββββββββββββ€ βββββββββββββββ€
β βββββββββββββ β βββββββββββββββ βββββββββββββββ βββββββββββββββ
β β 1 β β ββ 1 ββ ββ 1 ββ ββ 2 ββ
β βββββββββββββ β βββββββββββββββ βββββββββββββββ βββββββββββββββ
ββ¬ββββββββββββββ¬β ββ΄ββββββββββββββ΄β βββββββββββββββ€ ββ΄ββββββββββββββ΄β
| // Inspired from : [RxJS 5 pausableBuffered operation declaration](http://codepen.io/elhigu/pen/jqZmpV) | |
| // Simplified (but loosing in readability) and improved by sending final buffer on source$.complete with flusher$.next(1) | |
| import Rx from 'rxjs/Rx' | |
| function pausableBuffered(pauser$) { | |
| return Rx.Observable.create(subscriber$ => { | |
| var source$ = this | |
| var buffer$ = new Rx.Subject() | |
| var flusher$ = new Rx.Subject() |
| import Rx from 'rxjs/Rx'; | |
| var pauser = new Rx.Subject(); | |
| var source = Rx.Observable.interval(1000); | |
| var pauseable = pauser.switchMap(paused => paused ? Rx.Observable.never() : source); | |
| pauseable.subscribe(n => console.log('next', n), e => console.log('error', e), c => console.log('complete', c)); | |
| pauser.next(false); |
| var e = { | |
| itag: ['a', 'b'], | |
| s: ['a', 'b'], | |
| url: ['a', 'b'] | |
| } | |
| var f = { | |
| itag: ['c', 'd'], | |
| s: 's', | |
| url: ['c', 'd'] |