Methods
()
_InitCalled only once in the constructor
of the object, _Init, well, initialize the object.
Use it for initlizing variables, members, bind functions etc, so they can be used safely in _PostInit.
Note : There is no need to call super() on this member when immediately extending DisposableObject, the function is a stub.
()
_PostInitCalled only once in the constructor
of the object, right after _Init
. This allows
your constructor to perform operations on members etc, knowing they have been properly initilized with their default
or intended values.
Note : There is no need to call super() on this member when immediately extending DisposableObject, the function is a stub.
Methods
(p_func)
_BindBind the given function to this object and returns it.
Note that it replaces the function reference, hence referencing function before they are being bound in _Init
,
( i.e in the constructor ) will target an obsolete function.
Parameters:
Name | Type | Description |
---|---|---|
p_func |
* |
Members
:boolean
isReleasingWhether the object is currently in the process of being released or not.
Methods
Release()
Releases the object and returns it back to the pool.
If you want to do operations when the object is released, do so by overriding the _CleanUp
method.
()
_CleanUpCalled when the object is released. Resets most properties to their initial values.
Override this method in your own implementations to 'reset' the object to the state you want it to be
when it gets rented again through common.POOL.Rent
Examples:
MyClass extends DisposableObject{
_Init(){
this._arr = []; // Create member during _Init
}
_CleanUp(){
this._arr.length = 0; // Reset member during _CleanUp
}
}