webassembly/library: Make use of CustomEvent detail property.
This changes the CustomEvent for stdout to use the existing `detail` property of CustomEvent instead of adding a `data` property. Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
parent
0698dd72ea
commit
ea07ab04f8
@ -70,7 +70,7 @@ something to stdout. The following code demonstrates basic functionality:
|
||||
<script>
|
||||
document.addEventListener("micropython-print", function(e) {
|
||||
let output = document.getElementById("micropython-stdout");
|
||||
output.innerText += e.data;
|
||||
output.innerText += e.detail;
|
||||
}, false);
|
||||
|
||||
var mp_js_startup = Module["onRuntimeInitialized"];
|
||||
|
@ -33,8 +33,7 @@ mergeInto(LibraryManager.library, {
|
||||
process.stdout.write(b);
|
||||
} else {
|
||||
var c = String.fromCharCode(getValue(ptr + i, 'i8'));
|
||||
var printEvent = new CustomEvent('micropython-print');
|
||||
printEvent.data = c;
|
||||
var printEvent = new CustomEvent('micropython-print', { detail: c });
|
||||
document.dispatchEvent(printEvent);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user