You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
833 B

  1. "use strict";
  2. const conversions = require("webidl-conversions");
  3. const utils = require("./utils.js");
  4. exports.convert = (value, { context = "The provided value" } = {}) => {
  5. if (typeof value !== "function") {
  6. throw new TypeError(context + " is not a function");
  7. }
  8. function invokeTheCallbackFunction() {
  9. if (new.target !== undefined) {
  10. throw new Error("Internal error: invokeTheCallbackFunction is not a constructor");
  11. }
  12. const thisArg = utils.tryWrapperForImpl(this);
  13. let callResult;
  14. callResult = Reflect.apply(value, thisArg, []);
  15. }
  16. invokeTheCallbackFunction.construct = () => {
  17. let callResult = Reflect.construct(value, []);
  18. };
  19. invokeTheCallbackFunction[utils.wrapperSymbol] = value;
  20. invokeTheCallbackFunction.objectReference = value;
  21. return invokeTheCallbackFunction;
  22. };