Skip to content

Instantly share code, notes, and snippets.

@davidecavaliere
Created January 15, 2020 17:12
Show Gist options
  • Save davidecavaliere/d4b4673d0a917c5ec92111f9809fd3e3 to your computer and use it in GitHub Desktop.
Save davidecavaliere/d4b4673d0a917c5ec92111f9809fd3e3 to your computer and use it in GitHub Desktop.
setTimeout(() => {
this.$log.d('starting subscriber');
this.userService.findAll(1).subscribe((data) => {
this.$log.d('starting subscribed');
this.$log.d(data);
this.users = data;
})
}, 0);
setTimeout(() => {
this.$log.d('first subscriber 1 sec later');
this.userService.findAll(1).subscribe((data) => {
this.$log.d('first subscribed');
this.$log.d(data);
})
}, 1000);
setTimeout(() => {
this.$log.d('second subscriber 2 sec later');
this.userService.findAll(1).subscribe((data) => {
this.$log.d('second subscribed');
this.$log.d(data);
})
}, 2000);
setTimeout(() => {
this.$log.d('third subscriber 3 sec later, ttl expired. shoult hit the endpoint');
this.userService.findAll(1).subscribe((data) => {
this.$log.d('third subscribed');
this.$log.d(data);
})
}, 3000);
setTimeout(() => {
this.$log.d('fourth subscriber 4 sec later, argument changed. should hit the endpoint');
this.userService.findAll(2).subscribe((data) => {
this.$log.d(' fourth subscribed');
this.$log.d(data);
})
}, 4000);
setTimeout(() => {
this.$log.d('fifth subscriber 5 sec later, argument changed. should hit the endpoint');
this.userService.findAll(1).subscribe((data) => {
this.$log.d(' fifth subscribed');
this.$log.d(data);
})
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment