# EventDispatcher
[![Build status](https://travis-ci.org/vanruesc/eventdispatcher.svg?branch=master)](https://travis-ci.org/vanruesc/eventdispatcher) 
[![Windows Build status](https://ci.appveyor.com/api/projects/status/uyxure8ch73qr5bo?svg=true)](https://ci.appveyor.com/project/vanruesc/eventdispatcher) 
[![GitHub version](https://badge.fury.io/gh/vanruesc%2Feventdispatcher.svg)](http://badge.fury.io/gh/vanruesc%2Feventdispatcher) 
[![npm version](https://badge.fury.io/js/%40zayesh%2Feventdispatcher.svg)](http://badge.fury.io/js/%40zayesh%2Feventdispatcher) 
[![Dependencies](https://david-dm.org/vanruesc/eventdispatcher.svg?branch=master)](https://david-dm.org/vanruesc/eventdispatcher)

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


## Installation

This module can be installed from [npm](https://www.npmjs.com).

```sh
$ npm install @zayesh/eventdispatcher
``` 


## Usage

```javascript
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);
```

```javascript
var sth = new Something();

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

	alert("pow!");

});

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


## Documentation
[API](http://vanruesc.github.io/eventdispatcher/docs)


## 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.
