Skip to content

Instantly share code, notes, and snippets.

@jhusain
Created May 20, 2017 19:12
Show Gist options
  • Save jhusain/d6007e9cce59ac6f173449cd6841f9fc to your computer and use it in GitHub Desktop.
Save jhusain/d6007e9cce59ac6f173449cd6841f9fc 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