Property | Defined by | ||
---|---|---|---|
_list : Array The actual list of observers.
| ObserverList | ||
_notifyPolicy : int Our notification policy.
| ObserverList |
Method | Defined by | ||
---|---|---|---|
ObserverList(notifyPolicy:int = 2)
Constructor
| ObserverList | ||
add(observer:Object, index:int = -1):void
Add an observer to this list.
| ObserverList | ||
apply(func:Function):void
Apply some operation to all observers.
| ObserverList | ||
remove(observer:Object):void
Remove an observer from this list.
| ObserverList | ||
size():int
Return the size of the list.
| ObserverList |
Constant | Defined by | ||
---|---|---|---|
FAST_UNSAFE_NOTIFY : int = 2 [static] A notification ordering policy wherein the observers are notified
last to first so that they can be removed during the notification
process and new observers added will not inadvertently be notified
as well, but no copy of the observer list need be made.
| ObserverList | ||
SAFE_IN_ORDER_NOTIFY : int = 1 [static] A notification ordering policy indicating that the observers
should be notified in the order they were added and that the
notification should be done on a snapshot of the array.
| ObserverList |
_list | property |
protected var _list:Array
The actual list of observers.
_notifyPolicy | property |
protected var _notifyPolicy:int
Our notification policy.
ObserverList | () | constructor |
public function ObserverList(notifyPolicy:int = 2)
Constructor
ParametersnotifyPolicy:int (default = 2 )
|
add | () | method |
public function add(observer:Object, index:int = -1):void
Add an observer to this list.
Parametersobserver:Object — the index at which to add the observer, or -1 for the end.
|
|
index:int (default = -1 )
|
apply | () | method |
public function apply(func:Function):void
Apply some operation to all observers. The function to be passed in should expect one argument and either return void or a Boolean. If returning a Boolean, returning false indicates that the observer should be removed from the list.
Parametersfunc:Function |
remove | () | method |
public function remove(observer:Object):void
Remove an observer from this list.
Parametersobserver:Object |
size | () | method |
public function size():int
Return the size of the list.
Returnsint |
FAST_UNSAFE_NOTIFY | constant |
public static const FAST_UNSAFE_NOTIFY:int = 2
A notification ordering policy wherein the observers are notified last to first so that they can be removed during the notification process and new observers added will not inadvertently be notified as well, but no copy of the observer list need be made. This will not work if observers are added or removed from arbitrary positions in the list during a notification call.
SAFE_IN_ORDER_NOTIFY | constant |
public static const SAFE_IN_ORDER_NOTIFY:int = 1
A notification ordering policy indicating that the observers should be notified in the order they were added and that the notification should be done on a snapshot of the array.