ReadableStreamDefaultController.js [plain text]
function enqueue(chunk)
{
"use strict";
if (!@isReadableStreamDefaultController(this))
throw @makeThisTypeError("ReadableStreamDefaultController", "enqueue");
if (this.@closeRequested)
@throwTypeError("ReadableStreamDefaultController is requested to close");
if (this.@controlledReadableStream.@state !== @streamReadable)
@throwTypeError("ReadableStream is not readable");
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 (this.@closeRequested)
@throwTypeError("ReadableStreamDefaultController is already requested to close");
if (this.@controlledReadableStream.@state !== @streamReadable)
@throwTypeError("ReadableStream is not readable");
@readableStreamDefaultControllerClose(this);
}
function desiredSize()
{
"use strict";
if (!@isReadableStreamDefaultController(this))
throw @makeGetterTypeError("ReadableStreamDefaultController", "desiredSize");
return @readableStreamDefaultControllerGetDesiredSize(this);
}