Callable objects protocol

Sultan thysultan at gmail.com
Tue Dec 4 17:02:16 UTC 2018


Something along the lines of Symbol.iterator protocol for defining callback
objects i.e: Symbol.callable:

const obj = {
    [Symbol.callable]: function (...args) { return
this[Symbol.for('value')] },
    [Symbol.for(''value')]: 'value',
}

assert(obj() === 'value')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20181204/3ff33a9f/attachment-0001.html>


More information about the es-discuss mailing list