Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make it easy to create streams from other standards
This adds four new abstract operations which allow creating streams from other standards by supplying appropriate algorithms and values, instead of JavaScript objects: CreateReadableStream, CreateReadableByteStream, CreateWritableStream, and CreateTransformStream. CreateReadableStream and CreateWritableStream are now used when teeing readable streams and when creating TransformStreams, and will be used by Fetch and other standards. As part of this, the controller constructors no longer take any parameters. This is technically observable via their length property, but has no real impact, since they always threw anyway. As such, the impact on implementations is minimal. As for the changes to the guts of the spec: controllers are now created by a SetUpFooController operation instead of the constructor. The set-up operation takes algorithms as arguments. Each controller also has a SetUpFooControllerFromBar operation that extracts algorithms from the Javascript object that is passed to the stream constructor. This is used by the user-facing constructor. The algorithms are stored on the controller object. Each stream has an additional InitializeFooStream operation which performs common initialization and is called from both the constructor and the Create operation. Where previously there were calls to PromiseInvokeOrNoop there are now "calls" to the algorithms stored on the controller object. Fixes #813.
- Loading branch information