0

I have data that is updated every five minutes and if new records appear, a notification pops up.

Is it possible to somehow make the notification appear regardless of which browser tab the person is on?

  loadInfo(): void {
    timer(0, 300000).pipe(
      switchMap(() => this.letterService.getIsNew())
    ).
      pipe(takeUntil(this.destroy$))
      .subscribe(
        (data) => {
          data.filter(req => {
            this.toastr.info(`New request #${req.number}`, 'Attention!', {
              closeButton: true,
              disableTimeOut: true
            });
            this.letterService.isNewFalse(req.id).subscribe(
              () => { },
              error => {
                this.toastr.error(error.error.message);
              }
            )
          })
        })
  }
  • 1
    Toastr shows notifications as HTML inside the tab, so no. You can use the [Notification API](https://developer.mozilla.org/en-US/docs/Web/API/notification) to show desktop notifications instead (or less intrusively, [Badging API](https://developer.mozilla.org/en-US/docs/Web/API/Badging_API)). – Amadan Jan 28 '22 at 04:48
  • @Amadan Ok, thank you – user18016810 Jan 28 '22 at 05:05

0 Answers0