Cocoa Beans 0.0.54-beta0 Help

πŸ” Observer

Available Since 0.0.39

Observer is an object depending on the changes in observables. When the value of an observable changes, the observer is notified via the flagAsDirty method. Below is an example implementation of observer:

public class MyObserver<T> implements Observer { private final Observable<T> target; private boolean isDirty = false; private MyObserver(Observable<T> target) { this.target = target; } @Override public void flagAsDirty(Observable<?> observable) { if (observable != target) return; isDirty = true; // Using heartbeat or other way to get // the value after it has been flagged as dirty // this is a simple example no changes check } }

You can also use Watchers.

See also:

Last modified: 07 July 2025