Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

0.20.0 - Ergonomics, Observer overhaul

Observer overhaul

The script loading pipeline became more idiomatic with the use of observers.

What you would do previously with TransitionListener implementations you can now do with observers registered against each machine state, for example, to react to fresh scripts being loaded you can do the following:

#![allow(unused)]
fn main() {
app.add_observer(
    |trigger: On<LoadingCompleted>| println!("do stuff"),
);
}

Callback command changes

Callback commands now accept a post_callback function pointer which can be set to execute some logic right after the callback runs, to make working with observers and callbacks easier in general.

Ironing out edge cases in the script lifecycle

Contexts are now stored in a Context enum which also contains the “state” of the context. Contexts which are being processed by the pipeline will be marked as loading/reloading or unloading, allowing us to have more information when trying to run callbakcs against these.

Callbacks which are loading or unloading for example, will not have callbacks issued to them generally.