How do i explicitly trigger interval in rxjs

      autoRefreshGateways() {
    return interval(GATEWAY_REFRESH_INTERVAL).pipe(
      startWith(0),
      takeUntil(this.stopAutoRefresh),
      exhaustMap(() => this.fetchAllData())
    ).subscribe((gateways) => {
      this.gateways = gateways;
    }, () => {
      this.notificationsService.error(this.translateService.instant('zerotrust.gateway.list.error'), '');
    });
  }

I have this autoRefresh function which calls the api every 5 sec. In some scenario i dont want to wait for 5 second. I want to call fetchAllData immediatly based on some action from the UI. I have written a different function for that which will call fetchAllData. However is there a better solution to this?

Source: Angular Questions