⁘ common.pool

POOL

Pool singleton object for all non-ui objects in NKMjs.

go to → Members
Utils

Methods

staticGetClass(p_id) → {Constructor}

Retrieves a class constructor associated with a given ID.
In order for a constructor to be retrievable using GetClass, it needs to have been manually registered using Register before; or registered automatically through Rent before.

If you need to reliably retrieve a constructor using GetClass, make sure to Register that class before.
If you find yourself the need to manually register a class using a string ID, have a look at `common.BINDINGS.SetClass`, as it is very likely it has been designed for what you need to accomplish
Parameters:
Name Type Description
p_id string

String ID of the constructor to retrieve

staticRegister(p_class)

Registers a class to the pool.
Note that there is only very rare use cases where you may need to manually Register a class; as soon as you attempt to Rent an object instance, it will be automatically registered if it wasn't already.

The main use case for manual Register is to make sure a class instance is accessible through its string identifier, making it available in contexts that purposefully do no import @nkmjs modules.

Parameters:
Name Type Description
p_class class
Renting

Methods

staticRent(p_class)

Parameters:
Name Type Description
p_class constructor | String

Either a class constructor, or its associated string ID.

Misc

Methods

_Register(p_class)

Parameters:
Name Type Description
p_class DisposableObject

_Return(p_obj)

Parameters:
Name Type Description
p_obj DisposableObject