@rbxts/task-event-emitter
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

@rbxts/task-event-emitter

Event emitter for roblox-ts using stravant's GoodSignal class.

Installation

npm i @rbxts/task-event-emitter

Usage

Create an EventEmitter with an array of parameters:

const emitter = new EventEmitter<[player: Player]>(janitor);

Or, wrap an existing Roblox event:

const onChildAdded = EventEmitter.wrap(object.ChildAdded, janitor);

Example

import EventEmitter from "@rbxts/task-event-emitter";

const onChange = new EventEmitter<[property: string]>();

onChange.subscribe((property) => print(`Property ${property} changed!`));

onChange.emit("Name");
import EventEmitter from "@rbxts/task-event-emitter";

const emitter = new EventEmitter();

const subscription = emitter.subscribe(() => {});

if (!subscription.closed) {
	subscription.unsubscribe();
}

Package Sidebar

Install

npm i @rbxts/task-event-emitter

Weekly Downloads

0

Version

1.2.1

License

MIT

Unpacked Size

16.8 kB

Total Files

6

Last publish

Collaborators

  • littensy