
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.
ngraph.events
Advanced tools
Small and powerful eventing in node and browser
var eventify = require('ngraph.events');
var yourObject = {}; // any javascript object
eventify(yourObject);
// now any object can listen to events from your object
yourObject.on('beep', function(name) { console.log('Hello ' + name); });
// and you can fire events from your object:
yourObject.fire('beep', 'World!'); // prints 'Hello World!'
// stop listen to events:
yourObject.off('beep');
More advanced examples:
var eventify = require('ngraph.events');
var yourObject = eventify({});
// Pass context to event handler as last argument:
yourObject.on('beep', function () { console.log(this === yourObject); }, yourObject);
yourObject.fire('beep'); // prints true;
// Pass additional arguments to fire:
var onBop = function (x, y) { console.log(x + y); };
yourObject.on('bop', onBop);
yourObject.fire('bop', 40, 2); // prints 42;
// Remove given event handler for 'bop' event
yourObject.off('bop', onBop);
// Remove all event listeners from your object:
yourObject.off();
This module is a part of larger experiment which I'm currently working on. EventEmitter
seemed to be pretty heavyweighted for my needs, so I rolled out this tiny library :).
With npm do:
npm install ngraph.events
BSD 3-Clause
FAQs
Basic events supoort for ngraph.js
The npm package ngraph.events receives a total of 91,529 weekly downloads. As such, ngraph.events popularity was classified as popular.
We found that ngraph.events demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.