Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rcanepa/100fa510569c9ee0b320c9188471e713 to your computer and use it in GitHub Desktop.
Save rcanepa/100fa510569c9ee0b320c9188471e713 to your computer and use it in GitHub Desktop.
"Animations Allowed" problem
someObservable.retry(3)
consts tasks =
{
....{....5......2.......3...}
............{......5............4....3}
............................................{5...2...4}
.....................................................{...5}
}
tasks.map(task => task.filter(() => false));
consts tasks =
{
....{...........,...........}
............{.........................}
............................................{.........}
.....................................................{....}
}
tasks.map(task =>
Observable.concat(
Observable.of(1),
task.filter(() => false),
Observable.of(-1)))
consts tasks =
{
....{1...........,........-1}
............{1.......................-1}
............................................{1.......-1}
....................................................{1...-1}
}
tasks.
map(task =>
Observable.concat(
Observable.of(1),
task.filter(() => false),
Observable.of(-1))).
mergeAll()
{....1.....1..............-1...........-1....1.......1.-1...-1}
tasks.
map(task =>
Observable.concat(
Observable.of(1),
task.filter(() => false),
Observable.of(-1))).
mergeAll().
scan((acc, curr) => acc + curr, 0)
{....1.....2...............1...........0...1.......2..1...0}
tasks.
map(task =>
Observable.concat(
Observable.of(1),
task.filter(() => false),
Observable.of(-1))).
mergeAll().
scan((acc, curr) => acc + curr, 0).
map(value => value === 0)
{....false...false...............false.true..f......f.f...true}
tasks.
map(task =>
Observable.concat(
Observable.of(1),
task.
filter(() => false).
catch((e) => Observable.error(new SomeError(e))),
Observable.of(-1))).
mergeAll().
scan((acc, curr) => acc + curr, 0).
map(value => value === 0).
distinctUntilChanged();
animationsAllowed =
{...false..............................true.false.........true
let animsAllowed = true;
animationsAllowed.subscribe(val => animsAllowed = val);
try {
dosomething()
}
catch(e) {
throw OtherError(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment