mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 03:34:58 +00:00

This test proves the ability of TransformStream to execute caller supplied code in the start callback, and have access to TransformStreamDefaultController.
20 lines
559 B
HTML
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>
|