summaryrefslogtreecommitdiffstats
path: root/Tools/wasm/python.worker.js
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-07-01 10:16:25 (GMT)
committerGitHub <noreply@github.com>2022-07-01 10:16:25 (GMT)
commitca58ca8641267c67dc6a7e67ee4009906b350bbb (patch)
tree12a5cc867df231d1354a59d17afcd861b45f67ae /Tools/wasm/python.worker.js
parent113b309f18103343a195f7c53c41763acf295167 (diff)
downloadcpython-ca58ca8641267c67dc6a7e67ee4009906b350bbb.zip
cpython-ca58ca8641267c67dc6a7e67ee4009906b350bbb.tar.gz
cpython-ca58ca8641267c67dc6a7e67ee4009906b350bbb.tar.bz2
gh-84461: Improve WebAssembly in-browser demo (GH-91879)
* Buffer standard input line-by-line * Add non-root .editorconfig for JS & HTML indent * Add support for clearing REPL with CTRL+L * Support unicode in stdout and stderr * Remove \r\n normalization * Note that local .editorconfig file extends root * Only normalize lone \r characters (convert to \n) * Skip non-printable characters in buffered input * Fix Safari bug (regex lookbehind not supported) Co-authored-by: Christian Heimes <christian@python.org> (cherry picked from commit a8e333d79aa639417e496181bcbad2cb801a7a56) Co-authored-by: Trey Hunner <trey@treyhunner.com>
Diffstat (limited to 'Tools/wasm/python.worker.js')
-rw-r--r--Tools/wasm/python.worker.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/Tools/wasm/python.worker.js b/Tools/wasm/python.worker.js
index c3a8bdf..1b79460 100644
--- a/Tools/wasm/python.worker.js
+++ b/Tools/wasm/python.worker.js
@@ -35,15 +35,11 @@ class StdinBuffer {
}
}
-const stdoutBufSize = 128;
-const stdoutBuf = new Int32Array()
-let index = 0;
-
const stdout = (charCode) => {
if (charCode) {
postMessage({
type: 'stdout',
- stdout: String.fromCharCode(charCode),
+ stdout: charCode,
})
} else {
console.log(typeof charCode, charCode)
@@ -54,7 +50,7 @@ const stderr = (charCode) => {
if (charCode) {
postMessage({
type: 'stderr',
- stderr: String.fromCharCode(charCode),
+ stderr: charCode,
})
} else {
console.log(typeof charCode, charCode)