From 9081bddd5670da490f8853ac8ce5cfbaf75653df Mon Sep 17 00:00:00 2001 From: radmanplays <95340057+radmanplays@users.noreply.github.com> Date: Sat, 17 Feb 2024 15:17:08 +0330 Subject: [PATCH] update docs --- docs/.vitepress/config.ts | 7 +++++++ docs/apidocs/events/addEventListener.md | 20 ++++++++++++++++++++ docs/apidocs/index.md | 4 ++-- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 docs/apidocs/events/addEventListener.md diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 4bb0231..cd4049b 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -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' }, + ], + }, ], }, }); diff --git a/docs/apidocs/events/addEventListener.md b/docs/apidocs/events/addEventListener.md new file mode 100644 index 0000000..6a07255 --- /dev/null +++ b/docs/apidocs/events/addEventListener.md @@ -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. \ No newline at end of file diff --git a/docs/apidocs/index.md b/docs/apidocs/index.md index 94d9efe..0acf9d3 100644 --- a/docs/apidocs/index.md +++ b/docs/apidocs/index.md @@ -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) + - `displayToChat({msg: String})` - Displays client-side message to user's ingame chat gui. - `uwuify({string: String})`