
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.
A Flux dispatcher for applications that run on the server and the client.
For a more detailed example, see our example application.
Let's start with a store that can handle the actions:
var util = require('util'),
EventEmitter = require('events').EventEmitter;
function ExampleStore(context) {
this.navigating = false;
}
util.inherits(ExampleStore, EventEmitter);
ExampleStore.handlers = {
'NAVIGATE': 'handleNavigate'
};
ExampleStore.prototype.handleNavigate = function () {
this.navigating = true;
this.emit('update'); // Store may be listening for updates to state
this.emit('final'); // Action has been fully handled
};
ExampleStore.prototype.getState = function () {
return {
navigating: this.navigating
};
};
Now let's initialize our dispatcher and dispatch an action:
var Dispatchr = require('dispatchr'),
ExampleStore = require('./example-store.js'),
context = {};
Dispatchr.registerStore(ExampleStore);
var dispatcher = new Dispatchr(context);
dispatcher.dispatch('NAVIGATE', {}, function () {
// Action has been handled fully
});
This software is free to use under the Yahoo! Inc. BSD license. See the LICENSE file for license text and copyright information.
FAQs
A Flux dispatcher for applications that run on the server and the client.
The npm package dispatchr receives a total of 1,020 weekly downloads. As such, dispatchr popularity was classified as popular.
We found that dispatchr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.