Skip to content

Instantly share code, notes, and snippets.

@ssougnez
Created March 11, 2021 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssougnez/e5f6f40ccb3a1199bef03f37cae8918b to your computer and use it in GitHub Desktop.
Save ssougnez/e5f6f40ccb3a1199bef03f37cae8918b to your computer and use it in GitHub Desktop.
import { interval } from 'rxjs';
import { mergeMap, takeUntil } from 'rxjs/operators';
interval(1000)
.pipe(
takeUntil(this.destroy$),
mergeMap(() => this._http.put('http://localhost:3000/documents/1', { lastUpdate: new Date() }))
)
.subscribe(x => console.log('Document saved!'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment