Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

of-type-operator

A module for add ofType method to RxJS's Observable. It inspired by redux-observable.

npm version

usage

import { Observable } "rxjs/Observable";
import { Action } "of-type-operator";

const YOUR_ACTION_TYPE = "YOUR_ACTION_TYPE";
interface YourPayload {}

// this operator always expect `Observable<Action>` type.
const action$: Observable<Action<YourPayload>> = createAction$();

// if you don't want annotate source Observable(like `action$: Observable<Action>`), import module is only necessary to add this operator.
import "of-type-operator";

const payload$ = action$
  .ofType<YourPayload>(YOUR_ACTION_TYPE)
  .subscribe(console.log) // log your payload
  ;

// if your action incompatible with Action type, you can pass pickBy function to pick for your own type.
const payload$ = action$
  .ofType<YourPayload>(YOUR_ACTION_TYPE, (action: YourSpecificAction) => action.yourSpecficProperty)
  .subscribe(console.log) // log your payload
  ;

About

A module for add ofType method to RxJS's Observable.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages