-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51df806
commit 284edb3
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); | ||
``` |