new threejs/HostObject(optionsopt)
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Options for the host. Properties
|
Extends
Members
(readonly) deltaTime :number
Gets the amount of time in milliseconds since update was last called.
Type:
- number
- Overrides:
(readonly) id :string
Gets the string id of the object.
Type:
- string
- Overrides:
(readonly) now :number
Gets the current time in milliseconds.
Type:
- number
- Overrides:
(readonly) owner :Object
Gets the engine owner object of the host.
Type:
- Object
- Overrides:
Methods
addFeature(FeatureClass, forceopt, …args) → {boolean}
Instantiate a new Host feature and store it. Features must inherit from
AbstractHostFeature.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
FeatureClass |
Class | Class that will instantiate the feature. Must |
||
force |
boolean |
<optional> |
false | Whether or not to overwrite an existing |
args |
any |
<repeatable> |
Additional arguments to pass to the FeatureClass |
- Overrides:
Returns:
- Whether or not a feature was successfully added.
- Type
- boolean
emit(message, valueopt)
Send a message, causing listener functions for the message on this object
to be executed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The message to emit. |
|
value |
any |
<optional> |
Optional argument to pass to listener callbacks. |
- Overrides:
hasFeature(typeName) → {boolean}
Indicate whether a specified feature is installed on the host.
Parameters:
Name | Type | Description |
---|---|---|
typeName |
string | Name of the type of feature to look for. |
- Overrides:
Returns:
- Type
- boolean
listenTo(message, callback)
Execute a function when a message is received for this object.
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The message to listen for. |
callback |
function | Function to execute once the message is received. |
- Overrides:
listFeatures() → {Array.<string>}
List the names of the features installed on the host.
- Overrides:
Returns:
- Type
- Array.<string>
removeFeature(typeName) → {boolean}
Remove a feature from the object.
Parameters:
Name | Type | Description |
---|---|---|
typeName |
string | Name of the type of feature to remove. |
- Overrides:
Returns:
- Whether or not a feature was successfully removed.
- Type
- boolean
stopListening(message, callbackopt)
Prevent a function from being executed when a message is received for this
object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The message to stop listening for. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Overrides:
stopListeningByRegexp(regexp, callbackopt)
De-register callback(s) from being executed when messages matching the given
regular expression are received.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
regexp |
Regexp | regexp - The regular expression to filter messages with. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Overrides:
stopListeningToAll()
Prevent any functions from being executed when any message is received for
this object.
- Overrides:
update()
This function should be called in the engine's render loop. Executes update
loops for all features.
- Overrides:
wait(secondsopt, optionsopt) → {Deferred}
Return a deferred promise that will wait a given number of seconds before
resolving. The host will continuously update the wait promise during the
update loop until it resolves.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
seconds |
number |
<optional> |
0 | Number of seconds to wait before resolving. |
||||||||||||||||||||
options |
Object |
<optional> |
Optional options object Properties
|
- Overrides:
Returns:
- Type
- Deferred