@nativewrappers/client
Version:
Javascript/Typescript wrapper for the FiveM natives
20 lines (19 loc) • 383 B
JavaScript
export class LiteEvent {
constructor() {
this.handlers = [];
}
on(handler) {
this.handlers.push(handler);
}
off(handler) {
this.handlers = this.handlers.filter(h => h !== handler);
}
emit(...args) {
this.handlers.slice(0).forEach(h => {
h(...args);
});
}
expose() {
return this;
}
}