timeoutSettings.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. "use strict";
  2. var __defProp = Object.defineProperty;
  3. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4. var __getOwnPropNames = Object.getOwnPropertyNames;
  5. var __hasOwnProp = Object.prototype.hasOwnProperty;
  6. var __export = (target, all) => {
  7. for (var name in all)
  8. __defProp(target, name, { get: all[name], enumerable: true });
  9. };
  10. var __copyProps = (to, from, except, desc) => {
  11. if (from && typeof from === "object" || typeof from === "function") {
  12. for (let key of __getOwnPropNames(from))
  13. if (!__hasOwnProp.call(to, key) && key !== except)
  14. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15. }
  16. return to;
  17. };
  18. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  19. var timeoutSettings_exports = {};
  20. __export(timeoutSettings_exports, {
  21. TimeoutSettings: () => TimeoutSettings
  22. });
  23. module.exports = __toCommonJS(timeoutSettings_exports);
  24. var import_time = require("../utils/isomorphic/time");
  25. class TimeoutSettings {
  26. constructor(platform, parent) {
  27. this._parent = parent;
  28. this._platform = platform;
  29. }
  30. setDefaultTimeout(timeout) {
  31. this._defaultTimeout = timeout;
  32. }
  33. setDefaultNavigationTimeout(timeout) {
  34. this._defaultNavigationTimeout = timeout;
  35. }
  36. defaultNavigationTimeout() {
  37. return this._defaultNavigationTimeout;
  38. }
  39. defaultTimeout() {
  40. return this._defaultTimeout;
  41. }
  42. navigationTimeout(options) {
  43. if (typeof options.timeout === "number")
  44. return options.timeout;
  45. if (this._defaultNavigationTimeout !== void 0)
  46. return this._defaultNavigationTimeout;
  47. if (this._platform.isDebugMode())
  48. return 0;
  49. if (this._defaultTimeout !== void 0)
  50. return this._defaultTimeout;
  51. if (this._parent)
  52. return this._parent.navigationTimeout(options);
  53. return import_time.DEFAULT_PLAYWRIGHT_TIMEOUT;
  54. }
  55. timeout(options) {
  56. if (typeof options.timeout === "number")
  57. return options.timeout;
  58. if (this._platform.isDebugMode())
  59. return 0;
  60. if (this._defaultTimeout !== void 0)
  61. return this._defaultTimeout;
  62. if (this._parent)
  63. return this._parent.timeout(options);
  64. return import_time.DEFAULT_PLAYWRIGHT_TIMEOUT;
  65. }
  66. launchTimeout(options) {
  67. if (typeof options.timeout === "number")
  68. return options.timeout;
  69. if (this._platform.isDebugMode())
  70. return 0;
  71. if (this._parent)
  72. return this._parent.launchTimeout(options);
  73. return import_time.DEFAULT_PLAYWRIGHT_LAUNCH_TIMEOUT;
  74. }
  75. }
  76. // Annotate the CommonJS export names for ESM import in node:
  77. 0 && (module.exports = {
  78. TimeoutSettings
  79. });