Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrdoob/eventdispatcher.js

JavaScript events for custom objects
https://github.com/mrdoob/eventdispatcher.js

Last synced: 6 days ago
JSON representation

JavaScript events for custom objects

Awesome Lists containing this project

README

        

eventdispatcher.js
========

#### JavaScript events for custom objects ####

### Usage ###

```javascript
import { EventDispatcher } from 'EventDispatcher.js';

// Adding events to custom object

class Car extends EventDispatcher {

start() {

this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );

}

}

// Using events

const car = new Car();

car.addEventListener( 'start', function ( event ) {

alert( event.message );

} );

car.start();
```