lmath-api-docs/docs/api.md

52 lines
1.5 KiB
Markdown

# LMathPluginAPI
This is a documentation-ish for the `LMathPluginAPI` object, revealed to plugins at the init phase.
## Common
These methods and variables are available on both the backend part and the frontend part.
### api.getLogger()
Returns the `log4js` logger.
### api.getVersion()
Returns current L'Math version.
### api.getSettings()
Returns the settings object. If you need to modify settings, please see ___ (WIP).
### api.getUserSetting()
Returns the user settings object. If you need to modify settings, please see ___ (WIP).
----
### api.events
The event-specific API
#### events.on(eventName, callback)
Allows you to listen to L'Math-specific events.
#### events.fire(eventName, eventData)
Allows you to fire a custom-named event. The data will be passed as
----
### api.messages
The messaging-specific API
#### messages.on(messageName, callback)
Allows you to listen to plugin-specific IPC messages between the backend and the frontend.
Any data sent will be passed as an argument to the callback function.
**Just like with regular ipc messaging, you can't send functions or other non-json types.**
#### messages.send(messageName, messageData)
Allows you to send plugin-specific IPC messages between the backend and the frontend.
The messageData object will be converted to JSON and passed as a parsed object to any listeners on the other process.
**Just like with regular ipc messaging, you can't send functions or other non-json types.**
## Backend
### events
## Frontend
### events