ReadableStreamDefaultController.js [plain text]
function enqueue(chunk)
{
"use strict";
if (!@isReadableStreamDefaultController(this))
throw @makeThisTypeError("ReadableStreamDefaultController", "enqueue");
if (!@readableStreamDefaultControllerCanCloseOrEnqueue(this))
@throwTypeError("ReadableStreamDefaultController is not in a state where chunk can be enqueued");
return @readableStreamDefaultControllerEnqueue(this, chunk);
}
function error(error)
{
"use strict";
if (!@isReadableStreamDefaultController(this))
throw @makeThisTypeError("ReadableStreamDefaultController", "error");
if (this.@controlledReadableStream.@state !== @streamReadable)
@throwTypeError("ReadableStream is not readable");
@readableStreamDefaultControllerError(this, error);
}
function close()
{
"use strict";
if (!@isReadableStreamDefaultController(this))
throw @makeThisTypeError("ReadableStreamDefaultController", "close");
if (!@readableStreamDefaultControllerCanCloseOrEnqueue(this))
@throwTypeError("ReadableStreamDefaultController is not in a state where it can be closed");
@readableStreamDefaultControllerClose(this);
}
@getter
function desiredSize()
{
"use strict";
if (!@isReadableStreamDefaultController(this))
throw @makeGetterTypeError("ReadableStreamDefaultController", "desiredSize");
return @readableStreamDefaultControllerGetDesiredSize(this);
}