Type Definitions
Command
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
phetioID |
string | the id of the phet-io element | |
method |
string | name of method to invoke | |
args |
Array.<*> |
<optional> |
the parameters needed from the method to invoke |
An object holding the data for a single invocation command. Each Command consists of the needed
values to invoke one method call in the sim frame.
Type:
- Object
LaunchSimOptions
Properties:
Name | Type | Default | Description |
---|---|---|---|
debug |
boolean |
false
|
Launches the simulation that has better error reporting, for development. Can be overridden with the `?phetioDebug` query parameter flag |
queryString |
string |
""
|
appended to the simulation launch URL, can begin with '?' or '&' or neither |
passThroughQueryParameters |
boolean |
true
|
Set to true if the query parameters from the wrapper should propagate through to the simulation. |
onEvent |
function | null |
null
|
Callback called for each event from the simulation. Note that this listener is called for children events as well as the root. Listener has have two arguments; the first is the event object, and the second is the root event object. The event will either be the root event, or be a child/descendant of the root event. See the PhET-iO dev guide for more information. |
onSimInitialized |
function |
no-op
|
Callback after the sim has been fully initialized and is ready to be displayed. See Client.addSimInitializedListener for more info. |
onPhetioInitialized |
function |
no-op
|
Callback after the PhET-iO layer in the simulation frame is ready for communication. It can receive some PhET-iO commands (such as adding listeners or customization expressions) before the sim starts to launch. See Client.addPhetioInitializedListener for more info. |
onError |
function |
no-op
|
Callback called whenever an error is received from the sim. This listener exists for the lifetime of the wrapper. If wanting to add error listeners that can be removed, see Client.addErrorListener(). |
emitStates |
boolean |
false
|
Option whether states should be emitted in the data stream every frame. This
can be overridden by the ?phetioEmitStates query parameter. |
emitStatesInterval |
number |
1
|
Option to emit a state event to the data stream event N frames.
Usually there are about 60 frames per second, so emitStatesInterval=60 would emit a state about every second.
Can be overridden by the ?phetioEmitStatesInterval query parameter. |
emitHighFrequencyEvents |
boolean |
true
|
Whether events should be emitted in the data stream that
emit very frequently. Can be overridden by the ?phetioEmitHighFrequencyEvents query parameter |
simStartedMetadata |
Object |
{}
|
This metadata will be logged to the PhET-iO data stream in the
simStarted event on sim launch. |
The schema for the available options that can be passed to
Client.launchSim()
Type:
- Object