open-stage-control/resources
Matthijs Kooijman c5314fe17a custom-module: Call reload() function on auto-reload
This allows modules to re-initialize any state they need whenever the
module is reloaded.

Without this, any such initialization can also be done in the top
level of the custom module, but this has two problems:

 1. Top-level module code runs on load and reload, and for the initial
    load, it runs *before* the connections are set up, so trying to use
    send() would produce an error on load (not reload).

 2. Top-level module code runs for the primary custom module, but also
    for any nested modules, removing control about the process and
    ordering from the primary custom module. In addition, a module that
    can be used both as primary and nested module, there is no clean way
    to distinguish between these cases.

Both of these problems can be solved by doing some bookkeeping in the
global object, but that produces messy code.

This commit allows modules to define a reload() function, which is
called (for the primary module only) after the module is reloaded. This
means that any initialization for the first load can be done in init()
and for reloads in reload(), and in both cases all connections will
already have been set up solving issue 1. In addition, neither of these
functions are called for nested modules, solving issue 2 (and the
primary module can then stil explicitly call a reload function on nested
modules if needed, as shown in the examples).
2024-06-18 09:37:01 +02:00
..
docs custom-module: Call reload() function on auto-reload 2024-06-18 09:37:01 +02:00
fonts package: v1.16.5 with font loading hot fix 2022-06-01 16:39:25 +02:00
images misc: update discourse logo 2020-05-14 20:21:10 +02:00
overrides docs: update 2021-02-06 13:17:23 +01:00
mkdocs.yml docs: add tutorial, rm cpu warning for /EDIT (mostly irrelevant today) 2023-11-30 13:21:20 +01:00
README.md docs: remove github stars counter and bypass xhr request, do some clean 2020-04-25 16:02:06 +02:00

How to build the docs

# https://squidfunk.github.io/mkdocs-material/getting-started/
$ python3 -m pip install mkdocs-material


$ mkdocs serve              # make docs available on http://127.0.0.1:8000
# or
$ mkdocs build              # build docs in site/