blob: b0bb8623c85374a5e7c212291e0b14067a0b1d56 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://streams.spec.whatwg.org/#rs-class
typedef (ReadableStreamDefaultReader or ReadableStreamBYOBReader) ReadableStreamReader;
typedef (ReadableStreamDefaultController or ReadableByteStreamController) ReadableStreamController;
enum ReadableStreamReaderMode { "byob" };
enum ReadableStreamType { "bytes" };
[
Exposed=(Window,Worker,Worklet)
] interface ReadableStream {
[CallWith=ScriptState, RaisesException] constructor(optional any underlyingSource, optional any strategy);
readonly attribute boolean locked;
// TODO(yhirano): function length is different from what's specced. Fix it.
[RaisesException, CallWith=ScriptState] Promise<any> cancel(optional any reason);
[RaisesException, CallWith=ScriptState, MeasureAs=ReadableStreamGetReader] ReadableStreamReader getReader(optional ReadableStreamGetReaderOptions options);
[RaisesException, CallWith=ScriptState, MeasureAs=ReadableStreamPipeThrough] ReadableStream pipeThrough(
ReadableWritablePair transform, optional StreamPipeOptions options);
[RaisesException, CallWith=ScriptState, MeasureAs=ReadableStreamPipeTo] Promise<any> pipeTo(
WritableStream destination, optional StreamPipeOptions options);
[RaisesException, CallWith=ScriptState] sequence<ReadableStream> tee();
};