VoidFunction.js 833 B

123456789101112131415161718192021222324252627282930
  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. };