diff --git a/docs/apidocs/events/addEventListener.md b/docs/apidocs/events/addEventListener.md index 6a07255..c180976 100644 --- a/docs/apidocs/events/addEventListener.md +++ b/docs/apidocs/events/addEventListener.md @@ -12,8 +12,11 @@ It has the following valid values: - `event`: String representing the type of event being fired. - `data`: Object representing the original arguments to be passed to the callback. -- `update` - Called every client tick. No arguments passed to callback. +- `gui` Called when the Mod Manager GUI shows up. No arguments passed to callback. + +- `load` Called when all mods have finished loading. + +- `update` Called every client tick. No arguments passed to callback. ### (Function) Callback diff --git a/docs/apidocs/events/removeEventListener.md b/docs/apidocs/events/removeEventListener.md new file mode 100644 index 0000000..f477fd9 --- /dev/null +++ b/docs/apidocs/events/removeEventListener.md @@ -0,0 +1,32 @@ +# ModAPI.removeEventListener(String eventName, Function callback, Boolean slow?) +This method is used to add event listeners to the event name specified. + +## Arguments: + +### (String) eventName +Type of event to remove the listener from. Types of events are listed [here](addEventListener.md) + +### (Function) callback +The function to remove from the event listener array. + +### [Optional] (Boolean) slow +Wether or not to use the functions definition rather than it's reference to look in the listener array. Much slower with it on, but still fast. Do not use if events need to be added and removed rapidly. + +Example where it is not necessary: +``` +function myListener() { + // idk +} +ModAPI.addEventListener("update", myListener); +ModAPI.removeEventListener("update", myListener); +``` + +Example where it is necessary: +``` +ModAPI.addEventListener("update", function myListener() { + // idk +}); +ModAPI.removeEventListener("update", function myListener() { + // idk +}); +``` \ No newline at end of file