|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
833 bytes
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | const conversions = require("webidl-conversions");
|
|---|
| 4 | const utils = require("./utils.js");
|
|---|
| 5 |
|
|---|
| 6 | exports.convert = (value, { context = "The provided value" } = {}) => {
|
|---|
| 7 | if (typeof value !== "function") {
|
|---|
| 8 | throw new TypeError(context + " is not a function");
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | function invokeTheCallbackFunction() {
|
|---|
| 12 | if (new.target !== undefined) {
|
|---|
| 13 | throw new Error("Internal error: invokeTheCallbackFunction is not a constructor");
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | const thisArg = utils.tryWrapperForImpl(this);
|
|---|
| 17 | let callResult;
|
|---|
| 18 |
|
|---|
| 19 | callResult = Reflect.apply(value, thisArg, []);
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | invokeTheCallbackFunction.construct = () => {
|
|---|
| 23 | let callResult = Reflect.construct(value, []);
|
|---|
| 24 | };
|
|---|
| 25 |
|
|---|
| 26 | invokeTheCallbackFunction[utils.wrapperSymbol] = value;
|
|---|
| 27 | invokeTheCallbackFunction.objectReference = value;
|
|---|
| 28 |
|
|---|
| 29 | return invokeTheCallbackFunction;
|
|---|
| 30 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.