- From: Adam Rice <notifications@github.com>
- Date: Tue, 25 Oct 2016 20:29:49 -0700
- To: whatwg/streams <streams@noreply.github.com>
Received on Wednesday, 26 October 2016 03:30:19 UTC
Currently `transformer.transform()` is compulsory. The TransformStream constructor will throw a TypeError if you do not set it.
I think instead if `transformer.transform` is undefined it should be equivalent to
```javascript
transform(chunk, controller) {
controller.enqueue(chunk);
}
```
This enables two useful things:
* A transformer which just adds a fixed header and footer can be implemented with just `start()` and `flush()`.
* A transformer which just buffers can by implemented by specifying an empty _transformer_ and a strategy.
Both these things can be done by specifying the `transform()` method explicitly, but skipping it
1. Is shorter,
2. Enables optimisations by making the transformation unobservable from Javascript.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/565
Received on Wednesday, 26 October 2016 03:30:19 UTC