Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
yaeti
Advanced tools
Yet Another EventTarget Implementation
Weekly downloads
Readme
Yet Another EventTarget Implementation.
The library exposes both the EventTarget interface and the Event interface.
$ npm install yaeti --save
var yaeti = require('yaeti');
// Custom class we want to make an EventTarget.
function Foo() {
// Call EventTarget constructor
yaeti.EventTarget.call(this);
}
// Inherit EventTarget prototype
Foo.prototype = Object.create(yaeti.EventTarget.prototype);
Foo.prototype.constructor = Foo;
// Create an instance.
var foo = new Foo();
function listener1() {
console.log('listener1');
}
function listener2() {
console.log('listener2');
}
foo.addEventListener('bar', listener1);
foo.addEventListener('bar', listener2);
foo.removeEventListener('bar', listener1);
var event = new yaeti.Event('bar');
foo.dispatchEvent(event);
// Output:
// => "listener2"
yaeti.EventTarget
interfaceImplementation of the EventTarget interface.
function Foo() {
yaeti.EventTarget.call(this);
}
Foo.prototype = Object.create(yaeti.EventTarget.prototype);
Foo.prototype.constructor = Foo;
class Foo extends EventTarget () {
constructor () {
super();
}
}
The interface implements the addEventListener
, removeEventListener
and dispatchEvent
methods as defined by the W3C.
listeners
read-only propertyReturns an object whose keys are configured event types (String) and whose values are an array of listeners (functions) for those event types.
yaeti.Event
interfaceImplementation of the Event interface.
NOTE: Just useful in Node (the browser already exposes the native Event
interface).
var event = new yaeti.Event('bar');
FAQs
Yet Another EventTarget Implementation
The npm package yaeti receives a total of 516,042 weekly downloads. As such, yaeti popularity was classified as popular.
We found that yaeti 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
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.