Skip to content

Commit 284edb3

Browse files
committed
update
1 parent 51df806 commit 284edb3

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

docs/apidocs/events/addEventListener.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ It has the following valid values:
1212
- `event`: String representing the type of event being fired.
1313
- `data`: Object representing the original arguments to be passed to the callback.
1414

15-
- `update`
16-
Called every client tick. No arguments passed to callback.
15+
- `gui` Called when the Mod Manager GUI shows up. No arguments passed to callback.
16+
17+
- `load` Called when all mods have finished loading.
18+
19+
- `update` Called every client tick. No arguments passed to callback.
1720

1821

1922
### (Function) Callback
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# ModAPI.removeEventListener(String eventName, Function callback, Boolean slow?)
2+
This method is used to add event listeners to the event name specified.
3+
4+
## Arguments:
5+
6+
### (String) eventName
7+
Type of event to remove the listener from. Types of events are listed [here](addEventListener.md)
8+
9+
### (Function) callback
10+
The function to remove from the event listener array.
11+
12+
### [Optional] (Boolean) slow
13+
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.
14+
15+
Example where it is not necessary:
16+
```
17+
function myListener() {
18+
// idk
19+
}
20+
ModAPI.addEventListener("update", myListener);
21+
ModAPI.removeEventListener("update", myListener);
22+
```
23+
24+
Example where it is necessary:
25+
```
26+
ModAPI.addEventListener("update", function myListener() {
27+
// idk
28+
});
29+
ModAPI.removeEventListener("update", function myListener() {
30+
// idk
31+
});
32+
```

0 commit comments

Comments
 (0)