PageTransitionEventInit.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. const conversions = require("webidl-conversions");
  3. const utils = require("./utils.js");
  4. const EventInit = require("./EventInit.js");
  5. exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => {
  6. EventInit._convertInherit(globalObject, obj, ret, { context });
  7. {
  8. const key = "persisted";
  9. let value = obj === undefined || obj === null ? undefined : obj[key];
  10. if (value !== undefined) {
  11. value = conversions["boolean"](value, {
  12. context: context + " has member 'persisted' that",
  13. globals: globalObject
  14. });
  15. ret[key] = value;
  16. } else {
  17. ret[key] = false;
  18. }
  19. }
  20. };
  21. exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => {
  22. if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") {
  23. throw new globalObject.TypeError(`${context} is not an object.`);
  24. }
  25. const ret = Object.create(null);
  26. exports._convertInherit(globalObject, obj, ret, { context });
  27. return ret;
  28. };