New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@code-workers.io/ngx-destroy

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@code-workers.io/ngx-destroy

Utility service to manage subscriptions in a declarative way using takeUntil.

latest
npmnpm
Version
13.3.0
Version published
Maintainers
1
Created
Source

@code-workers.io/ngx-destroy

Utility service to manage subscriptions in a declarative way using takeUntil.

To handle subscriptions in a declarative way usually you do have following code:

import { OnDestroy } from '@angular/core';
import { interval, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'
@Component({
  //...
})
export class SomeComponent implements OnDestroy {
  private readonly destroy$ = new Subject();

  constructor() {
    interval(1000)
      .pipe(takeUntil(this.destroy$))
      .subscribe(// do smth.)
  }
  
  ngOnDestroy() {
    this.destroy$.next();
    this.destroy$.complete();
  }
}

With NgxDestroy you reduce a lot of boilerplate:

import { interval } from 'rxjs';
import { NgxDestroy } from '@mikelgo/ngx-destroy';

@Component({
  //...
  providers: [NgxDestroy]
})
export class SomeComponent {
  
  constructor(private readonly destroy$: NgxDestroy) {
    interval(1000)
      .pipe(takeUntil(this.destroy$))
      .subscribe(// do smth.)
  }
  
}

Installation

npm i @code-workers.io/ngx-destroy

Demo

A demo can be found here

Compatibility

  • ngx-destroy 13.3.0 is compatible with Angular >= 13.3.0

FAQs

Package last updated on 23 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts