![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
evented-command
Advanced tools
This project is inspirated by [jamuhl](https://github.com/jamuhl/backbone.CQRS).
This project is inspirated by jamuhl.
Project goal is to provide a simple command/event handling for evented systems like cqrs.
$ npm install evented-command
// get the hub
var hub = require('evented-command').hub;
// initialize the hub by passing the function that gets the command id from the event
hub.init(
function(evt) {
return evt.commandId;
}
);
// and the command
var Command = require('evented-command').Command;
// get the hub
var hub = require('evented-command').hub.create();
// initialize the hub by passing the function that gets the command id from the event
hub.init(
function(evt) {
var idEndIndex = evt.id.indexOf('_event');
var id = evt.id.substring(0, idEndIndex);
return id;
}
);
// and the command
var Command = require('evented-command').Command.create(hub);
// pass in events from your bus
bus.on('events', function(data){
hub.emit('events', data);
// use it with wildcards for mulit callback
// hub.emit('event:' + data.event, data);
});
// pass commands to bus
hub.on('commands', function(data) {
bus.emit('commands', data);
});
var cmd = new Command({
command: 'changePerson',
payload: {
id: 8,
name: 'my name'
}
});
// emit it
cmd.emit();
// if you want to observe the command pass a callback
cmd.emit(function(evt) {
});
// if you want to observe the command that generates any events pass an object like this:
cmd.emit({
event1: function(evt) {
},
event2: function(evt) {
}
});
Copyright (c) 2014 Adriano Raiano
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Project goal is to provide a simple command/event handling for evented systems like cqrs.
The npm package evented-command receives a total of 4 weekly downloads. As such, evented-command popularity was classified as not popular.
We found that evented-command demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.