Effect observation
React to derived state changes with Aurelia's effect observation APIs.
class MouseTracker {
@observable
coord = [0, 0];
}import { IObservation } from 'aurelia';
...
const observation = someContainer.get(IObservation);import { inject, IObservation } from 'aurelia';
@inject(IObservation)
class MyElement {
constructor(observation) {
// ...
}
}Run effect
Creating an Effect
Cleaning up effect
Watching a value with a getter
Watching a value with a string as expression
Effect examples
Creating a run effect that logs the user mouse movement on the document
Creating a run effect that sends a request whenever user focus/unfocus the browser tab
Last updated
Was this helpful?