Skip to content

Instantly share code, notes, and snippets.

@tobie
Created January 24, 2017 20:18
Show Gist options
  • Save tobie/54473a62c7f6984c3ada862e8cb68c96 to your computer and use it in GitHub Desktop.
Save tobie/54473a62c7f6984c3ada862e8cb68c96 to your computer and use it in GitHub Desktop.
<h4 id="legacy-callback-interface-object">Legacy callback interface object</h4>
The [=legacy callback interface object=] for a given [=callback interface=]
is a [=function object=].
It has properties that correspond to the [=constants=] defined on that interface,
as described in sections [[#es-constants]].
Note: Since an interface object is a [=function object=]
the <code>typeof</code> operator will return "function"
when applied to a [=legacy callback interface object=].
<div algorithm="create a legacy callback interface object">
The [=legacy callback interface object=]
for a given [=callback interface=] with [=identifier=] |id|
and [=Realm=] |realm| is created as follows:
1. Let |steps| be the following steps:
1. [=ECMAScript/throw=] a <emu-val>TypeError</emu-val>.
1. Let |F| be [=!=] [=CreateBuiltinFunction=](|realm|, |steps|, the [=%FunctionPrototype%=] of |realm|).
1. Perform [=!=] [=SetFunctionName=](|F|, |id|).
1. Perform [=!=] [=DefinePropertyOrThrow=](|F|, "length",
PropertyDescriptor{\[[Value]]: 0, \[[Writable]]: <emu-val>false</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>true</emu-val>}).
</div>
<h5 id="es-legacy-callback-interface-object-hasinstance">\[[HasInstance]]</h5>
<div algorithm="to invoke the internal [[HasInstance]] method of interface objects">
The internal \[[HasInstance]] method of the [=legacy callback interface object=] |A|
must behave as follows:
1. [=ECMAScript/throw=] a <emu-val>TypeError</emu-val> exception.
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment