Type Definitions
ClientConfig
- Description:
Configuration object for a client running in a browser runtime.
- Source:
Properties:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
role |
string | Role of the client in the application (e.g. 'player', 'controller'). |
||||||||||||||||||||||||||
app |
object |
<optional> |
Application configuration object. Properties
|
|||||||||||||||||||||||||
env |
object | Environment configuration object. Properties
|
Configuration object for a client running in a browser runtime.
Type:
- object
ServerConfig
- Description:
Configuration object for the server.
- Source:
Properties:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
app |
object |
<optional> |
Application configuration object. Properties
|
||||||||||||||||||||||||||||||
env |
object |
<optional> |
Environment configuration object. Properties
|
Configuration object for the server.
Type:
- object
SharedStateClassName
- Description:
User defined name for a class of SharedState
- Source:
User defined name for a class of SharedState
Type:
- string
SharedStateClassSchema
- Description:
Description of a SharedState data structure that describes the structure of a class of SharedState to be registered by ServerStateManager#registerSchema
A schema is the blueprint, or the definition from which shared states from a given class can be created.
It consists of a set of key / value pairs where the key is the name of the parameter (cf. ${SharedStateParameterName}), and the value is an object describing the parameter (cf. ${SharedStateParameterDescription}).
- Source:
Description of a SharedState data structure that describes the structure of a class of SharedState to be registered by ServerStateManager#registerSchema
A schema is the blueprint, or the definition from which shared states from a given class can be created.
It consists of a set of key / value pairs where the key is the name of the parameter (cf. ${SharedStateParameterName}), and the value is an object describing the parameter (cf. ${SharedStateParameterDescription}).
Type:
Example
const mySchema = {
triggerSound: {
type: 'boolean',
event: true,
},
volume: {
type: 'float'
default: 0,
min: -80,
max: 6,
}
};
server.stateManager.registerSchema('my-class-name', mySchema);
SharedStateParameterDescription
- Description:
Description of a parameter in a class of SharedState
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
'boolean' | 'string' | 'integer' | 'float' | 'enum' | 'any' | Type of the parameter |
||
default |
any | Default value of the parameter. Optional only if
|
||
nullable |
boolean |
<optional> |
false
|
Defines if the parameter is nullable.
When |
event |
boolean |
<optional> |
false
|
Define if the parameter is a volatile, i.e.
its value only exists on an update and is set back to |
filterChange |
boolean |
<optional> |
true
|
When set to |
immediate |
boolean |
<optional> |
false
|
When set to |
min |
number |
<optional> |
-Number.MIN_VALUE
|
Minimum value of the parameter. Only applies
for |
max |
number |
<optional> |
Number.MAX_VALUE
|
Maximum value of the parameter. Only applies
for |
list |
Array.<any> |
<optional> |
Possible values of the parameter. Only applies and
mandatory for |
|
metas |
object |
<optional> |
{}
|
Optional metadata of the parameter. |
Description of a parameter in a class of SharedState
Type:
- object
SharedStateParameterName
- Description:
User defined name of a parameter in a class of SharedState
- Source:
User defined name of a parameter in a class of SharedState
Type:
- string
pluginDeleteOnStateChangeCallback()
- Description:
Delete the registered pluginOnStateChangeCallback.
- Source:
pluginManagerDeleteOnStateChangeCallback()
- Description:
Delete the registered pluginManagerOnStateChangeCallback.
- Source:
pluginManagerOnStateChangeCallback(fullState, initiator)
- Description:
Callback executed when a plugin internal state is updated.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fullState |
object.<string, (ClientPlugin|ServerPlugin)> | List of all plugins. |
initiator |
ClientPlugin | ServerPlugin | null | Plugin that initiated the
update. The value is |
pluginOnStateChangeCallback(state)
- Description:
Callback executed when the plugin state is updated.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
state |
BasePlugin#state | Current state of the plugin. |
(async) serverStateManagerUpdateHook(updates, currentValues, contextopt) → {object}
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
updates |
object | Update object as given on a set callback, or result of the previous hook |
||
currentValues |
object | Current values of the state. |
||
context |
object |
<optional> |
null
|
Optionnal context passed by the creator of the update. |
Returns:
The "real" updates to be applied on the state.
- Type
- object
sharedStateCollectionOnUpdateCallback(state, newValues, oldValues, contextopt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
state |
SharedState | State that triggered the update. |
||
newValues |
Object | Key / value pairs of the updates that have been applied to the state. |
||
oldValues |
Object | Key / value pairs of the updated params before the updates has been applied to the state. |
||
context |
Mixed |
<optional> |
null
|
Optionnal context object that has been passed
with the values updates in the |
sharedStateDeleteOnUpdateCallback()
- Description:
Delete the registered sharedStateOnUpdateCallback.
- Source:
sharedStateOnUpdateCallback(newValues, oldValues, contextopt)
- Description:
Callback executed when updates are applied on a SharedState.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
newValues |
Object | Key / value pairs of the updates that have been applied to the state. |
||
oldValues |
Object | Key / value pairs of the updated params before the updates has been applied to the state. |
||
context |
Mixed |
<optional> |
null
|
Optionnal context object that has been passed
with the values updates in the |
stateManagerDeleteObserveCallback()
- Description:
Callback to execute in order to remove a stateManagerObserveCallback from the list of observer.
- Source:
(async) stateManagerObserveCallback(schemaName, stateId, nodeId)
- Description:
Callback executed when a state is created on the network.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
schemaName |
string | name of the schema |
stateId |
number | id of the state |
nodeId |
number | id of the node that created the state |