Skip to content

Commit

Permalink
feat(scripting-v8): allow to set the max listeners count
Browse files Browse the repository at this point in the history
By default any event that is listened more than 10 times will trigger a log error saying that there may be a memory leak. In some cases users may want to listen more than 10 times to a specific event this patch allow to not display a log message in those cases by setting the correct value to the setMaxEventListeners
  • Loading branch information
joelwurtz authored Feb 20, 2024
1 parent 68751bf commit ebd6f86
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions data/shared/citizen/scripting/v8/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,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;
Expand Down

0 comments on commit ebd6f86

Please sign in to comment.