Extends
This section list the main methods used to watch/unwatch signals on this object. For more info on signals, see signals
Methods
Unwatch(p_signal, p_fn, p_listener) → {common.pool.DisposableObjectEx}
Unwatch a signal broadcasted by this object
Parameters:
Name | Type | Default | Description |
---|---|---|---|
p_signal |
* | The signal that was being watched |
|
p_fn |
function | The callback to be removed |
|
p_listener |
* |
null
|
The callback's 'thisArg', if any |
Watch(p_signal, p_fn, p_listener) → {common.pool.DisposableObjectEx}
Watch a signal broadcasted by this object.
Note that while you can provide an anonymous function, you won't be able to Unwatch it.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
p_signal |
* | The signal to watch for |
|
p_fn |
function | The callback to trigger when the signal fires |
|
p_listener |
* |
null
|
The callback's 'thisArg', if any |
Examples:
let foo = someFunction;
object.Watch(SIGNAL.RELEASED, foo);
object.Watch(SIGNAL.RELEASED, foo, this);
object.Watch(SIGNAL.RELEASED, (obj)=>{ ... }));
WatchOnce(p_signalId, p_fn, p_listener) → {common.pool.DisposableObjectEx}
Watch a signal broadcasted by this object, once only; meaning if the signal the listener gets automatically removed right after the next signal broadcast.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
p_signalId |
* | The signal to watch for |
|
p_fn |
function | The callback to trigger when the signal fires |
|
p_listener |
* |
null
|
The callback's 'thisArg', if any |
(p_signal, …args)
_BroadcastParameters:
Name | Type | Attributes | Description |
---|---|---|---|
p_signal |
* | ||
args |
any |
<repeatable> |
Methods
()
_Init- Inherited From:
()
_PostInit- Inherited From:
Methods
(p_func)
_Bind- Inherited From:
Members
:boolean
isReleasing- Inherited From:
Methods
Release()
- Inherited From:
()
_CleanUp- Inherited From:
Methods
PreventRelease()
Interrupts the releasing process and prevents this object from being released : _CleanUp
won't be called,
and the object won't release
Needs to be called right after SIGNAL.RELEASING has been broadcasted, otherwise has no effect.
Examples:
myDisposableObject.Watch(
SIGNAL.RELEASED,
(obj)=>{ alert('Released !'); }
);
myDisposableObject.Watch(
SIGNAL.RELEASING,
(obj)=>{
obj.PreventRelease();
alert('Release prevented !');
}
);
myDisposableObject.Release(); // alert : 'Release prevented !'