New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ngx-observable-lifecycle

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-observable-lifecycle

[![npm version](https://badge.fury.io/js/ngx-observable-lifecycle.svg)](https://www.npmjs.com/package/ngx-observable-lifecycle) [![Build Status](https://travis-ci.org/cloudnc/ngx-observable-lifecycle.svg?branch=master)](https://travis-ci.org/cloudnc/ngx-o

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
2.8K
increased by36.28%
Maintainers
1
Weekly downloads
 
Created
Source

NgxObservableLifecycle

npm version Build Status Commitizen friendly License npm peer dependency version npm peer dependency version

NPM

This library is current a work in progress, but here's the basics of how it will work:

// ./src/app/child/child.component.ts

import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import {
  getObservableLifecycle,
  ObservableLifecycle,
} from 'ngx-observable-lifecycle';
import { take, takeUntil } from 'rxjs/operators';

@ObservableLifecycle()
@Component({
  selector: 'app-child',
  templateUrl: './child.component.html',
  styleUrls: ['./child.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ChildComponent {
  @Input() input: number;

  constructor() {
    const {
      onChanges,
      onInit,
      doCheck,
      afterContentInit,
      afterContentChecked,
      afterViewInit,
      afterViewChecked,
      onDestroy,
    } = getObservableLifecycle(this);

    onChanges
      .pipe(takeUntil(onDestroy))
      .subscribe(() => console.count('onChanges'));
    onInit.pipe(takeUntil(onDestroy)).subscribe(() => console.count('onInit'));
    doCheck
      .pipe(takeUntil(onDestroy))
      .subscribe(() => console.count('doCheck'));
    afterContentInit
      .pipe(takeUntil(onDestroy))
      .subscribe(() => console.count('afterContentInit'));
    afterContentChecked
      .pipe(takeUntil(onDestroy))
      .subscribe(() => console.count('afterContentChecked'));
    afterViewInit
      .pipe(takeUntil(onDestroy))
      .subscribe(() => console.count('afterViewInit'));
    afterViewChecked
      .pipe(takeUntil(onDestroy))
      .subscribe(() => console.count('afterViewChecked'));
    onDestroy.pipe(take(1)).subscribe(() => console.count('onDestroy'));
  }
}

FAQs

Package last updated on 19 May 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc