Socket
Book a DemoInstallSign in
Socket

@zayesh/eventdispatcher

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zayesh/eventdispatcher

A supportive base class that enables any object to dispatch events to registered listeners.

latest
Source
npmnpm
Version
0.1.8
Version published
Maintainers
1
Created
Source

EventDispatcher

Build status Windows Build status GitHub version npm version Dependencies

A supportive base class that enables any object to dispatch events to registered listeners.

Installation

This module can be installed from npm.

$ npm install @zayesh/eventdispatcher

Usage

import EventDispatcher from "@zayesh/eventdispatcher";

function Something() {

	EventDispatcher.call(this);

}

Something.prototype = Object.create(EventDispatcher.prototype);
Something.prototype.constructor = Something;

// If you want Something to be a true sub-class of another class,
// you can just use the apply method for multi-inheritance:
EventDispatcher.prototype.apply(Something.prototype);
var sth = new Something();

sth.addEventListener("boom", function() {

	alert("pow!");

});

sth.dispatchEvent({type: "boom"});

Documentation

API

Contributing

Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

Copyright (c) 2015 Raoul van Rueschen
Licensed under the Zlib license.

Keywords

event

FAQs

Package last updated on 26 Oct 2015

Did you know?

Socket

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.

Install

Related posts