How to use the @ngneat/until-destroy.untilDestroyed function in @ngneat/until-destroy

To help you get started, we’ve selected a few @ngneat/until-destroy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ngneat / until-destroy / integration / app / interval / interval.component.ts View on Github external
constructor() {
    this.intervalService.interval$
      .pipe(
        untilDestroyed(this),
        finalize(() =>
          console.log('IntervalComponent intervalService.interval$ stream has completed')
        )
      )
      .subscribe(value => {
        console.log(`IntervalService emitted value inside component ${value}`);
        this.valueFromIntervalService = value;
      });
  }
github ngneat / until-destroy / integration / app / interval / interval.service.ts View on Github external
constructor() {
    interval(1000)
      .pipe(untilDestroyed(this, 'destroy'))
      .subscribe(value => {
        console.log(`IntervalService emits value ${value}`);
        this.interval$.next(value);
      });
  }
github ngneat / until-destroy / integration / app / app.component.spec.ts View on Github external
constructor() {
        new Subject()
          .pipe(
            untilDestroyed(this),
            finalize(() => {
              this.disposed = true;
            })
          )
          .subscribe();
      }
    }
github ngneat / until-destroy / integration / app / app.component.spec.ts View on Github external
constructor() {
        new Subject()
          .pipe(
            untilDestroyed(this),
            finalize(() => {
              this.disposed = true;
            })
          )
          .subscribe();
      }
    }

@ngneat/until-destroy

RxJS operator that unsubscribes when Angular component is destroyed

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis