๐ชข Bindings
LogicBlocks provides a binding system that allows objects to listen to a particular logic block. Bindings allow you to observe inputs, outputs, errors, and state changes declaratively.
๐ฅ Observing Inputsโ
using var binding = logic.Bind();
binding.Watch((in MyLogicBlock.Input.SomeInput input) => {
// Watch for a particular input.
});
๐ค Observing Outputsโ
using var binding = logic.Bind();
binding.Handle((in MyLogicBlock.Output.SomeOutput output) => {
// Handle a particular output.
});
๐ Observing State Changesโ
using var binding = logic.Bind();
binding.When<MyLogicBlock.State.SomeState>(state => {
// Respond to a state change. This is only called when changing from a state
// that is not the type specified.
});
๐จ Observing Errorsโ
using var binding = logic.Bind();
binding.Catch<System.Exception>(e => {
// Catch an error.
});