2.0.15 • Published 6 months ago

@actionstack/epics v2.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

ActionStack Epics

Overview

Actionstack Epics is a middleware package that enables handling asynchronous operations and side effects in a reactive manner using RxJS. With support for streams, it is ideal for applications requiring complex event-driven logic.

Installation

Install Actionstack Epics using:

npm install @actionstack/epics

Features

  • Reactive side effect management using RxJS
  • Concurrent and sequential processing of streams
  • Supports dynamic addition and removal of epics
  • Integrates seamlessly with the Actionstack store

Usage

Configure the epics middleware in your store:

    import { createStore } from '@actionstack/store';
    import { epics, run } from '@actionstack/epics';
    import rootEpic from './epics';

    export const store = createStore({
      reducer: (state: any = {}) => state,
      dependencies: {},
    }, applyMiddleware(logger, epics));

    // Register the root epic
    store.dispatch(run(rootEpic));

Writing an Epic:

    import { ofType } from '@actionstack/epics';
    import { map } from 'rxjs/operators';
    import { fetchSuccess } from './actions';

    const fetchEpic = (action$, state$, dependencies) =>
      action$.pipe(
        ofType('FETCH_REQUEST'),
        map(() => fetchSuccess())
      );

    export default fetchEpic;

API Reference

Middleware

  • epics: Middleware to handle epics.

Utilities

  • run: Action to launch epics.
  • stop: Action to stop epics.
  • ofType: RxJS operator to filter actions by type.

Contribution

For bug reports or feature requests, please open an issue or submit a pull request on GitHub.

2.0.15

6 months ago

2.0.14

6 months ago

2.0.12

6 months ago

2.0.11

6 months ago

2.0.8

11 months ago

2.0.4

11 months ago

2.0.3

11 months ago

2.0.1

11 months ago

2.0.0

12 months ago