diff --git a/data/shared/citizen/scripting/v8/index.d.ts b/data/shared/citizen/scripting/v8/index.d.ts index f3da1ac909..f4764c0127 100644 --- a/data/shared/citizen/scripting/v8/index.d.ts +++ b/data/shared/citizen/scripting/v8/index.d.ts @@ -83,10 +83,12 @@ type CitizenImmediate = Omit; declare var Citizen: CitizenInterface; declare function addRawEventListener(eventName: string, callback: Function): void +declare function setMaxRawEventListeners(max: number): void declare function addEventListener(eventName: string, callback: Function, netSafe?: boolean): void declare function on(eventName: string, callback: Function): void declare function AddEventHandler(eventName: string, callback: Function): void +declare function setMaxEventListeners(max: number): void declare function addNetEventListener(eventName: string, callback: Function): void declare function onNet(eventName: string, callback: Function): void diff --git a/data/shared/citizen/scripting/v8/main.js b/data/shared/citizen/scripting/v8/main.js index b93205ffdc..ff96d90530 100644 --- a/data/shared/citizen/scripting/v8/main.js +++ b/data/shared/citizen/scripting/v8/main.js @@ -207,6 +207,9 @@ const EXT_LOCALFUNCREF = 11; global.addRawEventListener = rawEmitter.on.bind(rawEmitter); global.addRawEventHandler = global.addRawEventListener; + // Raw events configuration + global.setMaxRawEventListeners = rawEmitter.setMaxListeners.bind(rawEmitter); + // Client events global.addEventListener = (name, callback, netSafe = false) => { if (netSafe) { @@ -219,6 +222,9 @@ const EXT_LOCALFUNCREF = 11; }; global.on = global.addEventListener; + // Event Emitter configuration + global.setMaxEventListeners = emitter.setMaxListeners.bind(emitter); + // Net events global.addNetEventListener = (name, callback) => global.addEventListener(name, callback, true); global.onNet = global.addNetEventListener;