New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

saga-lite

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

saga-lite

A simple event bus inspired by redux-saga. Framework agnostic.

latest
Source
npmnpm
Version
0.1.4
Version published
Weekly downloads
6
-14.29%
Maintainers
1
Weekly downloads
 
Created
Source

saga-lite

A simple event bus inspired by redux-saga. Framework agnostic.

Installation

$ npm i -S saga-lite

Usage

First, create an instance of the saga in your app root:

//saga.js
import {createSaga} from 'saga-lite';

export default createSaga();

Now you may import your saga.js module, and handle/dispatch actions:

Handle an action

import saga from './saga.js';

saga.handle('MY_ACTION_TYPE', action => {
    console.log('handling', action);
});

Dispatch an action

import saga from './saga.js';

saga.dispatch({
    type: 'MY_ACTION_TYPE',
    myActionParam: 'foo'
});

Wait for an action

You may wait for an action dispatch by using "take":

import saga from './saga.js';

saga.handle('MY_ACTION_TYPE', async action => {
    const action2 = await saga.take('MY_ACTION_TYPE_2');
});

Keywords

saga

FAQs

Package last updated on 28 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts