kopia lustrzana https://github.com/micropython/micropython
webassembly/library: Fix formatting and style for Biome.
Signed-off-by: Damien George <damien@micropython.org>pull/13583/head
rodzic
26d6969fef
commit
c2cf58befc
|
@ -30,23 +30,33 @@ mergeInto(LibraryManager.library, {
|
||||||
|
|
||||||
mp_js_ticks_ms: () => Date.now() - MP_JS_EPOCH,
|
mp_js_ticks_ms: () => Date.now() - MP_JS_EPOCH,
|
||||||
|
|
||||||
mp_js_hook: function() {
|
mp_js_hook: () => {
|
||||||
if (ENVIRONMENT_IS_NODE) {
|
if (ENVIRONMENT_IS_NODE) {
|
||||||
var mp_interrupt_char = Module.ccall('mp_hal_get_interrupt_char', 'number', ['number'], ['null']);
|
const mp_interrupt_char = Module.ccall(
|
||||||
var fs = require('fs');
|
"mp_hal_get_interrupt_char",
|
||||||
|
"number",
|
||||||
|
["number"],
|
||||||
|
["null"],
|
||||||
|
);
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
var buf = Buffer.alloc(1);
|
const buf = Buffer.alloc(1);
|
||||||
try {
|
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 (n > 0) {
|
||||||
if (buf[0] == mp_interrupt_char) {
|
if (buf[0] === mp_interrupt_char) {
|
||||||
Module.ccall('mp_sched_keyboard_interrupt', 'null', ['null'], ['null']);
|
Module.ccall(
|
||||||
|
"mp_sched_keyboard_interrupt",
|
||||||
|
"null",
|
||||||
|
["null"],
|
||||||
|
["null"],
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
process.stdout.write(String.fromCharCode(buf[0]));
|
process.stdout.write(String.fromCharCode(buf[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code === 'EAGAIN') {
|
if (e.code === "EAGAIN") {
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue