TextAsset
@physion/app / Exports / TextAsset
Class: TextAsset
Serves as the base class for most classes in Physion.
CoreObject itself extends EventEmitter to allow notifying the outside world on important events.
Hierarchy
↳
TextAsset
Constructors
constructor
• new TextAsset(subtype?
, text?
): TextAsset
Parameters
Name | Type | Default value |
---|---|---|
subtype | TextAssetSubtype | TextAssetSubtype.plain |
text | string | "" |
Returns
Overrides
Properties
EVT_NAME_CHANGED
▪ Static
Readonly
EVT_NAME_CHANGED: "nameChanged"
The name of the event that is emitted whenever the name of this object changes.
The argument suplied is the new CoreObject.name of the object.
Inherited from
EVT_PROPERTY_CHANGED
▪ Static
Readonly
EVT_PROPERTY_CHANGED: "propertyChanged"
The name of the event that is emitted whenever a property of this object changes.
The arguments supplied are: (1) The name of the property that has changed and (2) the new value of that property.
Inherited from
EVT_UPDATED
▪ Static
Readonly
EVT_UPDATED: "updated"
Inherited from
Accessors
flags
• get
flags(): CoreObjectFlags
Returns
CoreObjectFlags
Inherited from
Asset.flags
id
• get
id(): string
Object's (unique) id
Note that the id of the object cannot be set (it is automatically assigned upon construction)
Returns
string
Inherited from
Asset.id
metaObject
• get
metaObject(): undefined
| MetaObject
Returns the MetaObject that describes this class
Returns
undefined
| MetaObject
Inherited from
Asset.metaObject
name
• get
name(): string
The object's name
The object's name is a free text value which defaults to an empty string.
Note that when the name of the object changes, the CoreObject.EVT_NAME_CHANGED signal will be emitted.
Returns
string
Inherited from
Asset.name
• set
name(v
): void
Parameters
Name | Type |
---|---|
v | string |
Returns
void
Inherited from
Asset.name
subtype
• get
subtype(): TextAssetSubtype
Returns
• set
subtype(v
): void
Parameters
Name | Type |
---|---|
v | TextAssetSubtype |
Returns
void
text
• get
text(): string
Returns
string
• set
text(v
): void
Parameters
Name | Type |
---|---|
v | string |
Returns
void
Methods
deserialize
▸ deserialize(d
): void
Parameters
Name | Type |
---|---|
d | any |
Returns
void
Overrides
getExtras
▸ getExtras(): any
Returns any extra data that this object needs to save during serialization.
In some cases an object might need to save some extra data without necessarily this extra data being part of its state (e.g. the AssetsLibrary of a Scene). In these cases subclasses can re-implement this method and return the data required.
The default implementation returns undefined
meaning that no extra data
needs to be saved during serialization.
Returns
any
Inherited from
getState
▸ getState(minified?
): any
Returns this object's state
The object's state is an object containing key/value pairs corresponding to this object's properties. For example:
{
id: "Ssba4ch5ruok",
name: "Circle",
radius: 2,
// ...
}
To avoid including properties that are currently in their default value you can set minified = true when calling getState.
Note that read-only properties are not part of the object's state (with the exception of the id)
Parameters
Name | Type | Default value | Description |
---|---|---|---|
minified | boolean | false | Whether to return a minified state or not |
Returns
any
Inherited from
getType
▸ getType(): AssetType
Returns
AssetType
Overrides
serialize
▸ serialize(): Object
Returns
Object
Name | Type |
---|---|
id | string |
name | string |
subtype | TextAssetSubtype |
text | string |
type | AssetType |
Overrides
setExtras
▸ setExtras(_x
): boolean
Sets any extra data that this object needs during de-serialization.
Returns true on success, otherwise returns false.
The default implementation does nothing and returns true.
Parameters
Name | Type |
---|---|
_x | any |
Returns
boolean
Inherited from
setFlag
▸ setFlag(flag
, on?
): void
Parameters
Name | Type | Default value |
---|---|---|
flag | CoreObjectFlags | undefined |
on | boolean | true |
Returns
void
Inherited from
setState
▸ setState(state
, updateId?
): boolean
Sets the object's state
Parameters
Name | Type | Default value | Description |
---|---|---|---|
state | any | undefined | The state to be set |
updateId | boolean | true | Whether to also update the id property |
Returns
boolean
True on success otherwise false
Inherited from
testFlag
▸ testFlag(flag
): boolean
Parameters
Name | Type |
---|---|
flag | CoreObjectFlags |
Returns
boolean