ladybird/Tests/LibWeb/Text/input/Streams/TransformStream-start-callback.html
Kenneth Myhra 5c6125c92b Tests/LibWeb: Add TransformStream start callback test
This test proves the ability of TransformStream to execute
caller supplied code in the start callback, and have access to
TransformStreamDefaultController.
2023-07-15 11:59:39 +02:00

20 lines
559 B
HTML

<script src="../include.js"></script>
<script>
test(() => {
const {readable} = new TransformStream({
start(controller) {
println("In start");
controller.enqueue("Hello, world!");
}
});
const reader = readable.getReader();
reader.read().then(function processText({done, value}) {
println(`Done: ${done}`);
if (done)
return;
println(value);
reader.read().then(processText);
});
});
</script>