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
This problem applies to both pxt-microbit and pxt-arcade. The following code will cause a second instance of a mbit/arcade simulator to appear:
const data = Buffer.fromUTF8("hello")
control.simmessages.send("foobar", data)
This is because all simmessages sent the above way have
the broadcast bit set, which is used to determine if a
new simulator can be created; if you send a message that doesn't match
to a simulator extension ("jacdac", "robot", etc.)
you will get a second mbit simulator
Not sure what the action for this is other than better documentation, but it seems odd that the fall through behavior is to create a new instance of the code simulator (mbit or arcade).
This problem applies to both pxt-microbit and pxt-arcade. The following code will cause a second instance of a mbit/arcade simulator to appear:
This is because all simmessages sent the above way have
the broadcast bit set, which is used to determine if a
new simulator can be created; if you send a message that doesn't match
to a simulator extension ("jacdac", "robot", etc.)
you will get a second mbit simulator
Repro with arcade: https://makecode.com/_38FRkP531hjj
Repro with mbit: https://makecode.microbit.org/_ETPMjLM6D717
The send function is declared as follows in pxt-common-packages/libs/base/controlmessage.ts:
The default value for parentOnly is false; if it is set to true, no new simulators will be created at all.
the implementation is in pxsim.pxtcore as
Here we can see how the broadcast bit is set based on !parentOnly.
The text was updated successfully, but these errors were encountered: