Command-bus-ts
This project provide a simple and decoupled solution from a command handle structure with supports of publish subscribe.
Usage
Install
npm i command-bus-ts
Basic Usage
var CommandBus = CommandBusvar test = ; test ; const res = test;/** global Middleware { command: { commandName: 'ok', aaa: 1 }, commandName: 'ok', handle: { execute: [Function: execute] }, middlewares: [ [Function], [Function] ], listners: DefaultPublisher { subscribers: Set { [Object] } }, x: 'xxx'}local Middleware { command: { commandName: 'ok', aaa: 1 }, commandName: 'ok', handle: { execute: [Function: execute] }, middlewares: [ [Function], [Function] ], listners: DefaultPublisher { subscribers: Set { [Object] } }, x: 'xxx', y: 'yyy'}local Middleware change handle { command: { commandName: 'ok', aaa: 1 }, commandName: 'ok', handle: { execute: [Function] }, middlewares: [ [Function], [Function] ], listners: DefaultPublisher { subscribers: Set { [Object] } }, x: 'xxx', y: 'yyy'}changedalert { req: { commandName: 'ok', aaa: 1 }, res: 'done changed', error: undefined}response of done changed**/
see more in docs