Created
July 4, 2011 14:35
-
-
Save alecmce/1063401 to your computer and use it in GitHub Desktop.
PureMVC Mediator extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var _view:IView; | |
private var _notifications:Array; | |
final protected function registerObserver(notificationName:String, closure:Function):void | |
{ | |
_view ||= View.getInstance(); | |
_view.registerObserver(notificationName, new Observer(closure, this)); | |
(_notifications ||= []).push(notificationName); | |
} | |
final protected function removeObservers():void | |
{ | |
_view ||= View.getInstance(); | |
for each (var notificationName:String in _notifications) | |
_view.removeObserver(notificationName, this); | |
_notifications.length = 0; | |
} | |
final protected function removeObserver(notificationName:String):void | |
{ | |
_view ||= View.getInstance(); | |
_view.removeObserver(notificationName, this); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment