Automatically binding extracted methods

André Bargull andre.bargull at udo.edu
Fri Jun 14 06:22:57 PDT 2013


@@create allows you to set up instance prototypes, here's an amended 
version of your example code using ES6 classes: 
https://gist.github.com/anba/9f0acbb29bf755d26f37

The updated version also gets rid of the "origProto" workaround, but 
requires a custom @@hasInstance hook. I've tested the script with [1], 
not sure if the other ES6 runtimes/transpilers already provide support 
for @@create and @@hasInstance.


- André

[1] https://github.com/anba/es6draft

> Thanks to proxies now having a separate trap for "invoke", we can automatically bind methods on "get". I've written down my thoughts here:
> http://www.2ality.com/2013/06/auto-binding.html
>
> Axel
>
> -- 
> Dr. Axel Rauschmayer
> axel at rauschma.de  <https://mail.mozilla.org/listinfo/es-discuss>
>
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130614/36fa03d1/attachment.html>


More information about the es-discuss mailing list