Registers a listener for updates from the model.
Registers a listener for updates from the model.
A listener is simply a partial function which receives instances of U
. Therefore
the listener can decide with pattern match cases which updates it wants to handle.
Example:
m.addListener { case NcviewSync.Open(path) => ... }
Note: If the listener should be removed at some point, it is important to store it somewhere:
val l: NcviewSync.Listener = { case NcviewSync.Open(path) => ... } m.addListener(l) ... m.removeListener(l)
Synchronously dispatches an update to all currently registered listeners.
Synchronously dispatches an update to all currently registered listeners. Non fatal exceptions are caught on a per-listener basis without stopping the dispatch.
Removes all listeners.
Removes all listeners. This is useful when disposing the model, to remove any unnecessary references.
Unregisters a listener for updates from the model.
Subclasses can override this to issue particular actions when the first listener has been registered
Subclasses can override this to issue particular actions when the first listener has been registered
Subclasses can override this to issue particular actions when the last listener has been unregistered
Subclasses can override this to issue particular actions when the last listener has been unregistered
A straight forward implementation of a model. The trait implements all required methods and provides a
dispatch
method to fire any updates.