summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-03-11 15:02:41 +1100
committerDamien George <damien@micropython.org>2024-03-22 14:31:25 +1100
commitc2cf58befcfd54d886fca879f05d8af2368d6cbe (patch)
tree17041c7aa8256ddc17f244ba2477a407836cdede
parent26d6969fefa18c1dbbb7bc852588fa00ae253d74 (diff)
webassembly/library: Fix formatting and style for Biome.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--ports/webassembly/library.js26
1 files changed, 18 insertions, 8 deletions
diff --git a/ports/webassembly/library.js b/ports/webassembly/library.js
index db5bac269..3f6c9cb61 100644
--- a/ports/webassembly/library.js
+++ b/ports/webassembly/library.js
@@ -30,23 +30,33 @@ mergeInto(LibraryManager.library, {
mp_js_ticks_ms: () => Date.now() - MP_JS_EPOCH,
- mp_js_hook: function() {
+ mp_js_hook: () => {
if (ENVIRONMENT_IS_NODE) {
- var mp_interrupt_char = Module.ccall('mp_hal_get_interrupt_char', 'number', ['number'], ['null']);
- var fs = require('fs');
+ const mp_interrupt_char = Module.ccall(
+ "mp_hal_get_interrupt_char",
+ "number",
+ ["number"],
+ ["null"],
+ );
+ const fs = require("fs");
- var buf = Buffer.alloc(1);
+ const buf = Buffer.alloc(1);
try {
- var n = fs.readSync(process.stdin.fd, buf, 0, 1);
+ const n = fs.readSync(process.stdin.fd, buf, 0, 1);
if (n > 0) {
- if (buf[0] == mp_interrupt_char) {
- Module.ccall('mp_sched_keyboard_interrupt', 'null', ['null'], ['null']);
+ if (buf[0] === mp_interrupt_char) {
+ Module.ccall(
+ "mp_sched_keyboard_interrupt",
+ "null",
+ ["null"],
+ ["null"],
+ );
} else {
process.stdout.write(String.fromCharCode(buf[0]));
}
}
} catch (e) {
- if (e.code === 'EAGAIN') {
+ if (e.code === "EAGAIN") {
} else {
throw e;
}