2.0.0 • Published 3 years ago

app-saga-utils v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Installation

npm install app-saga-utils

How to use

// User.watcher.ts
import { WatcherBase } from 'app-saga-utils';

import { UserActions } from '../redux';
import { UserSaga } from './User.saga';

export class UserWatcher extends WatcherBase<UserSaga> {
  constructor() {
    super(UserSaga);

    this.watchLatest(
      UserActions.SET_USER,
      'setUser'
    );
  }
}

// or

export const userWatcher = sagaWatcher(UserSaga);
watcher.watchLatest(UserActions.SET_USER, 'setUser');
// RootSagaBase.ts
import { RootSagaBase } from 'app-saga-utils';

import { UserWatcher } from './User.watcher';

export class RootSaga extends RootSagaBase {
  constructor() {
    super();

    this.addWatchers([
      new UserWatcher(),
    ]);
  }
}

and register your saga like usually new RootSagaBase().run(sagaMiddleware);

2.0.0

3 years ago

1.0.0

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago