You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which is a bit odd, since you have to look at the definition to understand what those parameters mean. Very different to Property<> to which you can just pass a type. I asked @pixelzoom and he agreed on finding Emitter confusing. So we were wondering if there's something better we can do.
The text was updated successfully, but these errors were encountered:
Very different to Property<> to which you can just pass a type.
Property takes a single value, and allows you to provide a Validator and phetioType to it. Emitter can take N values, and allows you to provide a validator and phetioType to each. The Validator is only for runtime assertion validation, and so you do not need to provide the valueType if it doesn't seem helpful to you (just as we do for Property).
The name attribute is a bit unfortunate, but it is for better data stream output, instead of an ordered list, they get a name for context:
{
"index": 819,
"time": 1740071114277,
"type": "model",
"phetioID": "ohmsLaw.general.model.stepSimulationAction.executedEmitter",
"name": "emitted",
"componentType": "EmitterIO<NumberIO>",
"data": {
"dt": 0.016 <------ here, instead of just an array!
}
}
Much of the runtime validation that we originally developed is obsolete now because of Typescript, and so doesn't need to be duplicated. For example, I rarely use valueType in Property now, because I can just say Property<number>() instead of Property( {valueType: 'number'}). So for Emitter it is the same way. The name and phetioType are required for PhET-iO instrumentation.
As part of phetsims/models-of-the-hydrogen-atom#125 I came across this:
Which is a bit odd, since you have to look at the definition to understand what those parameters mean. Very different to Property<> to which you can just pass a type. I asked @pixelzoom and he agreed on finding Emitter confusing. So we were wondering if there's something better we can do.
The text was updated successfully, but these errors were encountered: