Skip to content

Commit

Permalink
webassembly/library: Fix formatting and style for Biome.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Mar 22, 2024
1 parent 26d6969 commit c2cf58b
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions ports/webassembly/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c2cf58b

Please sign in to comment.