downspout
A framework to serialize the execution of event handlers for disorderly event emitting
Functions of this module
- Provide a framework for describing event handlers.
- Allow one event handler to execute as transaction processing.
- Queue the execution of event handlers.
Installation
npm install --save downspout
Please use browserify (or webpack) when using with browser.
Usage
Overview
const Downspout = ; const state = counter: 0; const useCases = { return Promise; } { return { ; }; }; const downspout = useCases; downspout; downspout; // -> "1"downspout; // -> "2"downspout; // -> "1"downspout; // -> "2"downspout; // -> "1"
Basic usage by CLI counter samples
- The simplest example
- Keywords:
- Use-cases
- constructor
- "execution:resolved" event
- execute
- Keywords:
- Wait for completion of asynchronous processing
- Keywords:
- Promise
- Keywords:
- Pass arguments to use-cases
- Keywords:
- Use-case arguments
- Keywords:
- Specify the variables on which the use case depends
- Keywords:
- context
- Keywords:
- Implementation pattern like the Flux
- Keywords:
- result
- Keywords:
- Runtime error handling
- Keywords:
- "execution:rejected" event
- error
- Keywords:
- Runtime error handling for development
- Keywords:
- isNoisy
- Keywords:
- Constants
- Keywords:
- EVENT_NAMES.USE_CASE_EXECUTION_RESOLVED
- EVENT_NAMES.USE_CASE_EXECUTION_REJECTED
- Keywords:
- Fork other use-cases
- Keywords:
- utils.fork
- Keywords:
- Separate layers of use cases and UI events
- Keywords:
- routes
- dispatch
- Keywords:
- Generate bound event emitters to pass any view libraries
- Keywords:
- generateExecutor
- generateDispatcher
- Keywords:
- Conclusion: Operable counter
- Example of the Flux (like) format
- Conclusion: Fizz Buzz Game
- Example of the MVC format
with the React
(Later)
with the Redux
As far as using bindActionCreators
, it was impossible.