mimacro Docs 1 Help

Events

The plugin event system allows your plugin to subscribe to events that happen in mimacro or with mimacro devices. Events are a fundamental part of the plugin system and are used to integrate actions with mimacro. For a beginner-friendly intro to using the plugin system, see making plugin actions.

You can listen to an event by writing a function matching the event name and exporting it from your module.

function onEnable(){ console.log("This plugin has just been enabled!"); } module.exports = {onEnable};

onEnable(plugin)

Fires when the plugin is first installed, mimacro starts, or the plugin is re-enabled. Passes in the plugin object required by some functions.

onDisable()

Fires when the plugin is disabled or mimacro is quit.

onGetActions()

Fires when mimacro is compiling a list of available actions for the user. Can return a list of action objects your plugin handles.

onAction(actionID, actionSettings)

Fires when an action handled by your plugin is triggered. Passes in the id of the action triggered and the settings for the action as an object with the setting ids as keys.

onDeviceMessage(message, device)

Fires when a mimacro device sends a serial message. Passes in the serial message as a string and the device that sent it as a device object.

onSettingUpdate(settingID)

Fires when a plugin setting is updated (whether by the user or the plugin). Passes in the id of the setting that has been updated.

Last modified: 06 June 2024