Actions
Actions are a part of the Hooks system. They provide a way to running your functions at a predefined point during the execution of Saturn's systems.
You can also create custom actions that allow you to use the system to execute hooks within your plugins.
Actions don't return anything back to the action hook. To do that you'll need to use Runners.
If you're unsure which type of hook to use, please see this section, describing the difference between actions and runners.
Register an Action
To register an Action you need to use the Actions system.
Please see the below sections for examples specific to different implementations of your code.
The 'Parameters' parameter is optional.
Specification
Parameters needed
Parameters not needed
Object-oriented functions
This will generate a new instance of the class
That means any variables defined in your class won't carry over, you should declare them globally or pass them in if you need them.
Static functions
Unregister an Action
You can unregister actions that you no longer need to run, this is useful if you only want to complete an action once when it may run multiple times.
Please see the below sections for examples specific to different implementations of your code.
The 'Parameters' parameter is optional.
Specification
Parameters needed
Object-oriented functions
This will generate a new instance of the class
That means any variables defined in your class won't carry over, you should declare them globally or pass them in if you need them.
Static functions
Run an Action
You can also run actions yourself, this is useful if you're creating Custom Actions.
List of Action Codes
Core
Action | Execution Time |
---|---|
Saturn.PostStart | After Saturn starts up all core systems except router. |
Saturn.End | Executes after everything else, or just before exit; is executed. |
Plugin Manager
Action | Execution Time |
---|---|
Saturn.PluginManager.PostLoad | After Saturn has loaded all plugins. |
Control Panel Plugin
If you're using the Control Panel plugin, there's loads of actions for that as well!
Control Panel HooksCustom Actions
To create a custom Action Code, you just need to enter an action name that doesn't already exist into the callback parameter.
We recommend using a prefix related to your plugin. For example: MyPlugin.ActionName
. This keeps your actions distinguished from others and avoids conflicts.
Last updated