[whatwg/encoding] bind encoder to self (#159)

This is a minor issue, but i think it's a more convenient to pass the `encode` into functions and use the same encoder thought out a serie of task. Instead of creating new instances or small anonymous function `.then(str => encoder.encode(str))`. A simple fix would be something like 
`let encode = new TextEncoder(); encode = encode.encode.bind(encode)`

```js
somePromise
  .then(new TextEncoder().encode)
  .then(console.log)
```

now it just throws `TypeError: Illegal invocation`

-- 
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/encoding/issues/159

Received on Sunday, 30 September 2018 19:26:43 UTC