UNPKG

fivem-js

Version:

Javascript/Typescript wrapper for the FiveM natives

24 lines (23 loc) 535 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LiteEvent = void 0; 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; } } exports.LiteEvent = LiteEvent;