PureMVC Framework for Haxe: API Documentation
Back | Index
interface org.puremvc.haxe.interfaces.IView

The interface definition for a PureMVC View.

In PureMVC, the `View` class assumes these responsibilities:

- Maintain a cache of `IMediator` instances.
- Provide methods for registering, retrieving, and removing `IMediators`.
- Managing the observer lists for each `INotification` in the application.
- Providing a method for attaching `IObservers` to an `INotification`'s observer list.
- Providing a method for broadcasting an `INotification`.
- Notifying the `IObservers` of a given `INotification` when it broadcast.

function hasMediator(mediatorName : String) : Bool
  Check if a `Mediator` is registered or not
function notifyObservers(note : INotification) : Void

  Notify the `IObservers` for a particular `INotification`.

  All previously attached `IObservers` for this `INotification`'s list are notified and are passed a reference to the `INotification` in the order in which they were registered.

function registerMediator(mediator : IMediator) : Void

  Register an `IMediator` instance with the `View`.

  Registers the `IMediator` so that it can be retrieved by name, and further interrogates the `IMediator` for its `INotification` interests.

  If the `IMediator` returns any `INotification` names to be notified about, an `Observer` is created encapsulating the `IMediator` instance's `handleNotification` method and registering it as an `Observer` for all `INotifications` the `IMediator` is interested in.

function registerObserver(noteName : String, observer : IObserver) : Void
  Register an `IObserver` to be notified of `INotifications` with a given name.
function removeMediator(mediatorName : String) : IMediator
  Remove an `IMediator` from the `View`.
function removeObserver(notificationName : String, notifyContext : Dynamic) : Void
  Remove a group of observers from the observer list for a given Notification name.
function retrieveMediator(mediatorName : String) : IMediator
  Retrieve an `IMediator` from the `View`.

Back | Index