0.3.3 • Published 7 years ago

of-type-operator v0.3.3

Weekly downloads
43
License
MIT
Repository
github
Last release
7 years ago

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
  ;
0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago