Skip to content

Commit

Permalink
Add module event block documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobGM committed Feb 8, 2018
1 parent 8ff5f05 commit d98c9b1
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion docs/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,39 @@ An example of module templates syntax:

Events
======
TODO

When you want to assign :ref:`tasks <actions>` for Astrality to perform, you have to define *when* to perform them. This is done by defining those ``actions`` in one of three available ``event`` blocks.

``on_startup``:
Tasks to be performed when Astrality first starts up.
Useful for compiling templates that don't need to change after they have been compiled.

``on_exit``:
Tasks to be performed when you kill the Astrality process.
Useful for cleaning up any unwanted clutter.

``on_period_change``:
Tasks to be performed when the specified module ``timer`` detects a new ``period``.
Useful for dynamic behaviour, periodic tasks, and templates that should change during runtime.
This event will never be triggered when no module timer is defined.
More on timers follows in :ref:`the next section <timers>`.

Example of module event blocks:

.. code-block:: yaml
module/module_name:
on_startup:
...startup actions...
on_period_change:
...period change actions...
on_exit:
...shutdow actions...
.. note::
On Astrality startup, the ``on_startup`` event will be triggered, but **not** ``on_period_change``. The ``on_period_change`` event will only be triggered when the ``timer`` defined ``period`` changes *after* Astrality startup.

.. _actions:

Expand Down

0 comments on commit d98c9b1

Please sign in to comment.