When the "typeof window" check is run within a web worker the window is
undefined, causing an error because "require" is only defined in a Node
environment. Change the logic to reflect the true intentions of when this
code should run, ie in Node only.
Signed-off-by: Damien George <damien@micropython.org>
This changes the CustomEvent for stdout to use the existing `detail`
property of CustomEvent instead of adding a `data` property.
Signed-off-by: David Lechner <david@pybricks.com>