npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ng2-reactor

v0.2.0

Published

A set of utilities for leveraging rxjs more heavily in angular 2

Downloads

7

Readme

ng2-reactor

A small set of utilities for "closing the loop" to build a uni directional data flow in Angular 2. It provides mechanisms for automatically generating useful Observable's inside of Angular components related to events.

For an example see: ng2-redux-todos

Services

ReactiveComponent

This is a base class that implements all of the lifecycle hooks and proxies them into streams. These streams are provided as protected members for subclasses. This allows you to create workflows that depend upon the angular lifecycle.

The events are mapped using the following pattern: drop the ng, lowcase the first letter, append $. For example:

  • ngOnInit -> onInit$
  • ngOnDestroy -> onDestroy$

Additionally, lifecycle$ will emit all lifecycle events.

ngOnChanges is handled separately. There is a dedicated changes$ observable containing values are a SimpleChanges object.

Note that helpers are also provided to further split the changes. One may do this.changes$.map(reactiveChange('propertyName')) to focus on a specific property. To get only the value rather than the metadata, one may further use reactiveChangeValue.

ReactiveSource

This is a decorator the produces Observables suitable for click bindings. Any field decorated with this should have a type of Observable. The field will be initialized to an Observable. Furthermore, a shadow property will be also assigned to the object with the name of fieldName_Sink. Component templates may use this shadow property as an output binding to send values through the stream. For instance

@ReactiveSource() private deleteTodo$: Observable<string>;

would be used in a template as

<button (click)="deleteTodo$_Sink(todo.id);">Delete</button>

Form Binding

bindFormState(group: FormGroup) provides a mechanism for synchronizing the value in a form with an observable. This is most useful in conjunction with a redux implementation such as ngrx/store where your form state lives in the application state. This allows form values to be changed simply by dispatching to the store.

The value of the input stream should match the shape of group.valueChanges.

second

Sometimes you want to sample something using Observable#withLatestFrom because Observable#sample is broken. second is a function of 2 arguments that returns its second argument so you don't have to repeatedly write code like (_, v) => v