Lifecycle Events
Reef emits custom events throughout the lifecycle of a reactive signal or component.
reef:signal
is emitted when a signal is modified. Theevent.detail
property contains theprop
andvalue
that were changed, and theaction
that was done to the data.reef:start
is emitted on a component element when reef starts listening for reactive data changes.reef:stop
is emitted on a component element when reef stops listening for reactive data changes.reef:before-render
is emitted on a component element before it renders a UI update. Running theevent.preventDefault()
method will cancel the render.reef:render
is emitted on a component element when reef renders a UI update.
You can listen for Reef events with the Element.addEventListener()
method.
// Log whenever an element is rendered into
document.addEventListener('reef:render', function (event) {
console.log('The UI was just updated inside this element.');
console.log(event.target);
});