Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
/ bucket-events Public archive

TypeScript event management system that offers both functional and declarative approaches to handle events.

Notifications You must be signed in to change notification settings

raxelo/bucket-events

Repository files navigation

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 your tsconfig 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!"

About

TypeScript event management system that offers both functional and declarative approaches to handle events.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published