Subclassing Function

Nelo Mitranim me at mitranim.com
Sat Oct 24 22:07:30 UTC 2015


On second thought, a construct method wouldn't add anything that classes don't do better. Let's just stick with call:

```javascript
class SubFunction extends Function {
  someState = {}

  // Assigned as internal [[Call]] property.
  [Symbol.functionCall]() {
    // ...
  }

  someMethod() {
    // ...
  }
}

const sub = new SubFunction()
sub()
```


More information about the es-discuss mailing list