1.0.9 • Published 2 years ago
bucket-events v1.0.9
Bucket
TypeScript event library inspired on Bukkit's event system and ReflectedEventHandler.
⚠️ If you want to enjoy the library to the fullest and use decorators to register event handlers, you must enable
experimentalDecorators
&emitDecoratorMetadata
on yourtsconfig
file.
Installation
npm i bucket-events
Usage
This code is taken from one of the examples
import ChatListener from './ChatListener';
import ChatEvent from './ChatEvent';
import { newEventManager } from 'bucket-events';
// Create a new event manager:
const manager = newEventManager();
const listener = new ChatListener();
// Register all event handlers on a listener instance:
manager.registerEvents(listener);
// Fire an event:
manager.fire(new ChatEvent('Lucas', 'hello world!')); // "author: Lucas, body: hello world!"