mrdoob / Eventdispatcher.js
Licence: mit
JavaScript events for custom objects
Stars: ✭ 247
Programming Languages
javascript
184084 projects - #8 most used programming language
eventdispatcher.js
JavaScript events for custom objects
Usage
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();
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].