Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
radmanplays committed Feb 19, 2024
1 parent 51df806 commit 284edb3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/apidocs/events/addEventListener.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions docs/apidocs/events/removeEventListener.md
Original file line number Diff line number Diff line change
@@ -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
});
```

0 comments on commit 284edb3

Please sign in to comment.