⁘ common.pool

DisposableObjectEx

Add broadcasting capabilities to common.pool.DisposableObject.

go to → Members

Extends

Broadcasting

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

protected_Broadcast(p_signal, …args)

Parameters:
Name Type Attributes Description
p_signal *
args any <repeatable>
Initialization

Methods

protectedoverride-me_Init()

Inherited From:

protectedoverride-me_PostInit()

Inherited From:
Utils

Methods

protected_Bind(p_func)

Inherited From:
Pooling

Group of methods related to the NKMjs pooling system.

Members

read-onlyisReleasing :boolean

Inherited From:

Methods

Release()

Inherited From:

protectedoverride-me_CleanUp()

Inherited From:
Misc

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 !'