new UID()
Manage UIDs inside FORGE.
UID is singleton, so if you have multiple instances in the same page you MUST avoid UID conflict.
UID is singleton, so if you have multiple instances in the same page you MUST avoid UID conflict.
- Source:
Extends
Members
(readonly) alive :boolean
Get the alive flag value of the object.
Type:
- boolean
- Inherited From:
- Source:
(readonly) className :string
Get the class name of the object.
Type:
- string
- Inherited From:
- Source:
data :*
Get and set any custom data you want to associate to this object.
Type:
- *
- Inherited From:
- Source:
debug :boolean
Get and set the debug flag.
Type:
- boolean
- Inherited From:
- Source:
(readonly) onDestroy :FORGE.EventDispatcher
Get the onDestroy FORGE.EventDispatcher, this event is emitted at the end of the destroy sequence.
Type:
- Inherited From:
- Source:
(readonly) tags :Array
Get the tags associated to this object.
Type:
- Array
- Inherited From:
- Source:
(readonly) uid :string
Get the uid of the object.
Type:
- string
- Inherited From:
- Source:
warning :boolean
Get and set the warning flag.
Type:
- boolean
- Inherited From:
- Source:
Methods
(static) exists(uid) → {boolean}
Does a uid exists?
Parameters:
Name | Type | Description |
---|---|---|
uid |
string | The uid you want to check. |
- Source:
Returns:
Return true if uid is already registered, false if not.
- Type
- boolean
(static) filterType(uids, className) → {Array.<string>}
Filter an array of uids and return only uids of a specific className.
Parameters:
Name | Type | Description |
---|---|---|
uids |
Array.<string> | Array of uids to filter by className. |
className |
string | Class name of object to filter. |
- Source:
Returns:
Returns an array of uids filtered by className.
- Type
- Array.<string>
(static) generate() → {string}
Generate a uid.
- Source:
Returns:
Return a UID string.
- Type
- string
(static) get(value, classNameopt) → {*}
Get a registered object from its uid.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
string | Array | The uid or array of uids of object(s) you want to get. | |
className |
string |
<optional> |
The className of the object you want |
- Source:
Returns:
Returns the object(s) related to the filters.
- Type
- *
(static) getuids(className) → {Array.<string>}
Get all uids or uids of a specific className.
Parameters:
Name | Type | Description |
---|---|---|
className |
string | Type of uids you want to get, if undefined this will return all the uids. |
- Source:
Returns:
Returns an array of uids.
- Type
- Array.<string>
(static) isTypeOf(uid, className) → {boolean}
Tell if this uid matches an object of a specific className.
Parameters:
Name | Type | Description |
---|---|---|
uid |
string | uid of the object you want to check the className of. |
className |
string | The className you want to check. |
- Source:
Returns:
Returns true if the object is of the asked className.
- Type
- boolean
(static) register(object) → {boolean}
Register an object into the uid index.
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | The object you want to register into the index. |
- Source:
Returns:
Return true if the object is added to UID, false if not.
- Type
- boolean
(static) unregister(object)
Unregister an object from the uid index.
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | The object you want to unregister from the index. |
- Source:
(static) validate(object) → {boolean}
Validate recursively a uid.
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | The object you want to validate into the index. |
- Source:
Returns:
Returns the validate status.
- Type
- boolean
destroy()
Basic destroy method, prevent double destroy, change the alive flag.
- Inherited From:
- Source:
log(value)
Basic log method, log a string in the console if debug is enabled.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | The value you want to log in the console. |
- Inherited From:
- Source:
warn(valuenullable)
Basic warn method, log a warn string in the console if warning is enabled.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
string | Object |
<nullable> |
The value you want to warn in the console. |
- Inherited From:
- Source: