Skip to content

Instantly share code, notes, and snippets.

Avatar

Sébastien Sougnez ssougnez

View GitHub Profile
View wamr-105.ts
function foo() {
console.log('Hello');
bar();
}
function bar() {
console.log('Good bye')
}
View wamr-104.ts
import { Observable } from 'rxjs';
import { delay, retryWhen } from 'rxjs/operators';
observable
.pipe(
retryWhen(errors => errors.
pipe(
delay(2500)
)
)
View wamr-103.ts
import { interval, Observable } from 'rxjs';
import { retryWhen } from 'rxjs/operators';
observable
.pipe(
retryWhen(errors => interval(2500))
)
.subscribe({
next: x => console.log(`${x} received`),
complete: () => console.log('Completed'),
View wamr-101.ts
import { Observable } from 'rxjs';
import { retryWhen, tap } from 'rxjs/operators';
const observable = new Observable<number>(observer => {
let x = 0;
const interval = setInterval(() => {
if (x === 5) {
observer.error('Oops');
}
View wamr-102.ts
import { Observable } from 'rxjs';
import { retryWhen, take } from 'rxjs/operators';
observable
.pipe(
retryWhen(errors => errors.pipe(take(2)))
)
.subscribe({
next: x => console.log(`${x} received`),
complete: () => console.log('Completed'),
View wamr-100.ts
import { Observable, of, throwError } from 'rxjs';
import { catchError, finalize, map } from 'rxjs/operators';
const observable = new Observable<number>(observer => {
let x = 0;
const interval = setInterval(() => {
if (x === 0) {
observer.error('Oops');
}
View wamr-99.ts
import { Observable, of } from 'rxjs';
import { catchError, finalize } from 'rxjs/operators';
const observable = new Observable<number>(observer => {
let x = 0;
const interval = setInterval(() => {
if (x === 5) {
observer.error('Oops');
}
View wamr-98.ts
import { Observable } from 'rxjs';
import { retry } from 'rxjs/operators';
const observable = new Observable<number>(observer => {
let x = 0;
const interval = setInterval(() => {
if (x === 5) {
observer.error('Oops');
}
View wamr-97.ts
import { Observable } from 'rxjs';
import { retry } from 'rxjs/operators';
const observable = new Observable<number>(observer => {
let x = 0;
const interval = setInterval(() => {
if (x === 5 && Math.random() < .5) {
observer.error('Oops');
}
View wamr-93.ts
import { Observable } from 'rxjs';
const observable = new Observable<number>(observer => {
let x = 0;
const interval = setInterval(() => {
if (x === 5) {
observer.error('Oops');
}
else {