Damien George
c2cf58befc
webassembly/library: Fix formatting and style for Biome.
...
Signed-off-by: Damien George <damien@micropython.org>
2024-03-22 14:31:25 +11:00
Damien George
ae6bcc9d23
webassembly: Use POSIX write for output and add stderr.
...
All output is now handled by Emscripten's stdio facility.
Signed-off-by: Damien George <damien@micropython.org>
2024-03-22 13:06:39 +11:00
Damien George
8e3b701dee
webassembly: Enable time localtime, gmtime, time, time_ns.
...
Signed-off-by: Damien George <damien@micropython.org>
2024-03-22 13:05:54 +11:00
Damien George
76898cbfa1
webassembly: Implement MICROPY_PY_RANDOM_SEED_INIT_FUNC.
...
Signed-off-by: Damien George <damien@micropython.org>
2024-03-22 13:05:54 +11:00
Damien George
8282bd93a2
webassembly: Move MP_JS_EPOCH init to library postset.
...
This eliminates the need for wrapper.js to run to set up the time.
Signed-off-by: Damien George <damien@micropython.org>
2024-03-22 13:05:54 +11:00
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