PureMVC Framework for Haxe: API Documentation
Back | Index
class org.puremvc.haxe.core.Controller
implements org.puremvc.haxe.interfaces.IController

A Singleton `IController` implementation.

In PureMVC, the `Controller` class follows the 'Command and Controller' strategy, and assumes these responsibilities:

- Remembering which `ICommand`s are intended to handle which `INotifications`.
- Registering itself as an `IObserver` with the `View` for each `INotification` that it has an `ICommand` mapping for.
- Creating a new instance of the proper `ICommand` to handle a given `INotification` when notified by the `View`.
- Calling the `ICommand`'s `execute` method, passing in the `INotification`.

Your application must register `ICommands` with the Controller. The simplest way is to subclass `Facade`, and use its `initializeController` method to add your registrations.

function executeCommand(note : org.puremvc.haxe.interfaces.INotification) : Void
function hasCommand(notificationName : String) : Bool
function registerCommand(notificationName : String, commandClassRef : Class<org.puremvc.haxe.interfaces.ICommand>) : Void
function removeCommand(notificationName : String) : Void
static function getInstance() : org.puremvc.haxe.interfaces.IController

Back | Index