Commit Graph

6 Commits

Author SHA1 Message Date
Nicholas H.Tollervey
14c2b64131 webassembly: Replace typeof window check with ENVIRONMENT_IS_NODE flag.
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>
2023-07-13 13:24:35 +10:00
Antonin ENFRUN
db19ee7e15 webassembly/library: Extract and send data to print as UInt8Array.
This allows utf-8 data to work.  It's the receiving layer's responsibility
to deal with decoding the data.
2022-12-13 17:16:37 +11:00
David Lechner
ea07ab04f8 webassembly/library: Make use of CustomEvent detail property.
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>
2022-11-11 13:21:28 +11:00
Nicholas H.Tollervey
db978d7155 webassembly: Dispatch micropython-print via document not mp_js_stdout. 2022-11-07 15:09:56 +11:00
Damien George
d65edaa232 webassembly: Use Date's now() instead of getTime().
Using now() is a bit faster because it doesn't need to create a new Date.

Signed-off-by: Damien George <damien@micropython.org>
2022-11-03 18:47:48 +11:00
Nicholas H.Tollervey
af54d2ce9f
javascript: Rename this port to 'webassembly'. 2022-08-22 12:03:39 +01:00