pub trait View<Body> where
Body: Debug + 'static, {
fn register_observer(
&self,
interest: Interest,
observer: Rc<dyn Observer<Body>>
);
fn remove_observer(
&self,
interest: &Interest,
notify_context: &Rc<dyn NotifyContext>
);
fn notify(&self, note: Rc<dyn Notification<Body>>);
}
Expand description
The definition for a PureMVC View.
In PureMVC, the View class assumes these responsibilities:
- Maintain a cache of Mediator instances.
- Provide methods for registering, retrieving, and removing Mediator’s.
- Managing the observer lists for each Notification in the application.
- Providing a method for attaching Observer’s to an Notification’s observer list.
- Providing a method for broadcasting an Notification.
- Notifying the Observer’s of a given Notification when it broadcast.
Required Methods
fn register_observer(
&self,
interest: Interest,
observer: Rc<dyn Observer<Body>>
)
fn register_observer(
&self,
interest: Interest,
observer: Rc<dyn Observer<Body>>
)
Register an Observer to be notified of Notification’s with a given name.
fn remove_observer(
&self,
interest: &Interest,
notify_context: &Rc<dyn NotifyContext>
)
fn remove_observer(
&self,
interest: &Interest,
notify_context: &Rc<dyn NotifyContext>
)
Remove a group of observers from the observer list for a given Notification name.
fn notify(&self, note: Rc<dyn Notification<Body>>)
fn notify(&self, note: Rc<dyn Notification<Body>>)
Notify the Observer’s for a particular Notification.
All previously attached Observer’s for this Notification’s list are notified and are passed a reference to the Notification in the order in which they were registered.