Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/mrdoob/eventdispatcher.js
- Owner: mrdoob
- License: mit
- Created: 2011-10-26T02:45:59.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2022-06-08T02:05:36.000Z (over 2 years ago)
- Last Synced: 2024-12-03T20:52:17.361Z (18 days ago)
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 319
- Watchers: 16
- Forks: 81
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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();
```