Skip to content

Commit a1d47c3

Browse files
committed
repl: Update to new emscripten APIs
Fixes #10.
1 parent 4af9c41 commit a1d47c3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

repl/repl.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ async function createREPL(elements) {
2222

2323
try {
2424
const dateTimeFormat = new Intl.DateTimeFormat();
25-
timeZone = Module.allocateUTF8(dateTimeFormat.resolvedOptions().timeZone);
25+
timeZone = Module.stringToNewUTF8(
26+
dateTimeFormat.resolvedOptions().timeZone
27+
);
2628
} catch {
27-
timeZone = Module.allocateUTF8("UTC");
29+
timeZone = Module.stringToNewUTF8("UTC");
2830
}
2931

3032
if (Module._initialize_repl(timeZone) !== 0)
@@ -94,7 +96,7 @@ async function createREPL(elements) {
9496
return node;
9597
},
9698
execute(text) {
97-
const encodedText = Module.allocateUTF8(text);
99+
const encodedText = Module.stringToNewUTF8(text);
98100
let oldRepl = globalDisplayToUser.repl;
99101
try {
100102
globalDisplayToUser.repl = repl.private.outputs;

0 commit comments

Comments
 (0)