Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
radmanplays committed Feb 17, 2024
1 parent 98c07c1 commit 9081bdd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ export default defineConfig({
{ text: 'Introduction', link: '/apidocs/' },
],
},
{
text: 'Events',
collapsed: false,
items: [
{ text: 'ModAPI.addEventListener(String eventName, Function callback)', link: '/apidocs/events/addEventListener' },
],
},
],
},
});
20 changes: 20 additions & 0 deletions docs/apidocs/events/addEventListener.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# ModAPI.addEventListener(String eventName, Function callback)
This method is used to add event listeners to the event name specified.

## Arguments:

### (String) eventName
This argument is used to specify internally which listener array to add the callback to.
It has the following valid values:

- `event`
Called when any event is called. Passes an object with properties:
- `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.


### (Function) Callback
The function to call when this event fires.
4 changes: 2 additions & 2 deletions docs/apidocs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ It has the following properties:
It has the following methods:
- `addEventListener(eventName: String, callback: Function) : void`
- Documentation [here](events/addEventListener.md)
- `require(componentName: String)`
- Documentation [here](globals/require.md)
<!-- - `require(componentName: String)`
- Documentation [here](globals/require.md) -->
- `displayToChat({msg: String})`
- Displays client-side message to user's ingame chat gui.
- `uwuify({string: String})`
Expand Down

0 comments on commit 9081bdd

Please sign in to comment.