Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A simple event bus inspired by redux-saga

NotificationsYou must be signed in to change notification settings

InterAl/saga-lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.jsimport{createSaga}from'saga-lite';exportdefaultcreateSaga();

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

Handle an action

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

Dispatch an action

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

Wait for an action

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

importsagafrom'./saga.js';saga.handle('MY_ACTION_TYPE',asyncaction=>{constaction2=awaitsaga.take('MY_ACTION_TYPE_2');});

About

A simple event bus inspired by redux-saga

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp