pub trait View<Body> where
Body: 'static + Debug, {
fn register_observer(
&self,
interest: Interest,
observer: Rc<dyn Observer<Body> + 'static>
);
fn remove_observer(
&self,
interest: &Interest,
notify_context: &Rc<dyn NotifyContext + 'static>
);
fn notify(&self, note: Rc<dyn Notification<Body> + 'static>);
}
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> + 'static>
)
fn register_observer(
&self,
interest: Interest,
observer: Rc<dyn Observer<Body> + 'static>
)
Register an Observer to be notified of Notification’s with a given name.
fn remove_observer(
&self,
interest: &Interest,
notify_context: &Rc<dyn NotifyContext + 'static>
)
fn remove_observer(
&self,
interest: &Interest,
notify_context: &Rc<dyn NotifyContext + 'static>
)
Remove a group of observers from the observer list for a given Notification name.
fn notify(&self, note: Rc<dyn Notification<Body> + 'static>)
fn notify(&self, note: Rc<dyn Notification<Body> + 'static>)
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.
Implementations on Foreign Types
sourceimpl<Body> View<Body> for BaseView<Body> where
Body: 'static + Debug,
impl<Body> View<Body> for BaseView<Body> where
Body: 'static + Debug,
fn notify(&self, note: Rc<dyn Notification<Body> + 'static>)
fn register_observer(
&self,
interest: Interest,
observer: Rc<dyn Observer<Body> + 'static>
)
fn remove_observer(
&self,
interest: &Interest,
context: &Rc<dyn NotifyContext + 'static>
)
sourceimpl<Body> View<Body> for BaseFacade<Body> where
Body: 'static + Debug,
impl<Body> View<Body> for BaseFacade<Body> where
Body: 'static + Debug,
sourcefn notify(&self, note: Rc<dyn Notification<Body> + 'static>)
fn notify(&self, note: Rc<dyn Notification<Body> + 'static>)
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.
NOTE: Use this method only if you are sending custom Notifications. Otherwise use the sendNotification method which does not require you to create the Notification instance.