Expand description
EntityCreatedEvent and EntityPropertyChangeEvent types are emitted when an entity is created or an entity’s
property value is changed.
Client code can subscribe to these events with the Context::subscribe_to_event<IxaEvent>(handler) method:
ⓘ
// Suppose `InfectionStatus` is a property of the entity `Person`.
// A type alias for property change events makes code more concise and readable.
pub type InfectionStatusEvent = PropertyChangeEvent<Person, InfectionStatus>;
// Suppose we want to execute the following function whenever `InfectionStatus` changes.
fn handle_infection_status_change(context: &mut Context, event: InfectionStatusEvent){
// ... handle the infection status change event ...
}
// We do so by subscribing to this event.
context.subscribe_to_event::<InfectionStatusEvent>(handle_infection_status_change);A non-derived property sits on the type-erased side of the boundary of its dependent’s PropertyValueStore, so it
needs to somehow trigger the creation of and emit the change events for its dependents in a type-erased way.
Property change events are triggered and collected on the outside of the type-erased PropertyValueStore boundary,
because a non-derived p
Structs§
- Entity
Created Event - Emitted when a new entity is created. These should not be emitted outside this module.
- Property
Change Event - Emitted when a property is updated. These should not be emitted outside this module.