Skip to content

mrdoob/eventdispatcher.js

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
January 9, 2021 00:07
src
June 7, 2022 22:14
January 8, 2021 17:22

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();

About

JavaScript events for custom objects

Resources

License

Stars

Watchers

Forks

Packages

No packages published