ReadableStreamDefaultController.js [plain text]
function initializeReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark)
{
"use strict";
if (arguments.length !== 5 && arguments[4] !== @isReadableStream)
@throwTypeError("ReadableStreamDefaultController constructor should not be called directly");
return @privateInitializeReadableStreamDefaultController.@call(this, stream, underlyingSource, size, highWaterMark);
}
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");
@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);
}