debugControllerDispatcher.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.DebugControllerDispatcher = void 0;
  6. var _utils = require("../../utils");
  7. var _debugController = require("../debugController");
  8. var _dispatcher = require("./dispatcher");
  9. /**
  10. * Copyright (c) Microsoft Corporation.
  11. *
  12. * Licensed under the Apache License, Version 2.0 (the 'License");
  13. * you may not use this file except in compliance with the License.
  14. * You may obtain a copy of the License at
  15. *
  16. * http://www.apache.org/licenses/LICENSE-2.0
  17. *
  18. * Unless required by applicable law or agreed to in writing, software
  19. * distributed under the License is distributed on an "AS IS" BASIS,
  20. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. * See the License for the specific language governing permissions and
  22. * limitations under the License.
  23. */
  24. class DebugControllerDispatcher extends _dispatcher.Dispatcher {
  25. constructor(connection, debugController) {
  26. super(connection, debugController, 'DebugController', {});
  27. this._type_DebugController = void 0;
  28. this._listeners = void 0;
  29. this._type_DebugController = true;
  30. this._listeners = [_utils.eventsHelper.addEventListener(this._object, _debugController.DebugController.Events.StateChanged, params => {
  31. this._dispatchEvent('stateChanged', params);
  32. }), _utils.eventsHelper.addEventListener(this._object, _debugController.DebugController.Events.InspectRequested, ({
  33. selector,
  34. locator
  35. }) => {
  36. this._dispatchEvent('inspectRequested', {
  37. selector,
  38. locator
  39. });
  40. }), _utils.eventsHelper.addEventListener(this._object, _debugController.DebugController.Events.SourceChanged, ({
  41. text,
  42. header,
  43. footer,
  44. actions
  45. }) => {
  46. this._dispatchEvent('sourceChanged', {
  47. text,
  48. header,
  49. footer,
  50. actions
  51. });
  52. }), _utils.eventsHelper.addEventListener(this._object, _debugController.DebugController.Events.Paused, ({
  53. paused
  54. }) => {
  55. this._dispatchEvent('paused', {
  56. paused
  57. });
  58. }), _utils.eventsHelper.addEventListener(this._object, _debugController.DebugController.Events.SetModeRequested, ({
  59. mode
  60. }) => {
  61. this._dispatchEvent('setModeRequested', {
  62. mode
  63. });
  64. })];
  65. }
  66. async initialize(params) {
  67. this._object.initialize(params.codegenId, params.sdkLanguage);
  68. }
  69. async setReportStateChanged(params) {
  70. this._object.setReportStateChanged(params.enabled);
  71. }
  72. async resetForReuse() {
  73. await this._object.resetForReuse();
  74. }
  75. async navigate(params) {
  76. await this._object.navigate(params.url);
  77. }
  78. async setRecorderMode(params) {
  79. await this._object.setRecorderMode(params);
  80. }
  81. async highlight(params) {
  82. await this._object.highlight(params.selector);
  83. }
  84. async hideHighlight() {
  85. await this._object.hideHighlight();
  86. }
  87. async resume() {
  88. await this._object.resume();
  89. }
  90. async kill() {
  91. await this._object.kill();
  92. }
  93. async closeAllBrowsers() {
  94. await this._object.closeAllBrowsers();
  95. }
  96. _onDispose() {
  97. _utils.eventsHelper.removeEventListeners(this._listeners);
  98. this._object.dispose();
  99. }
  100. }
  101. exports.DebugControllerDispatcher = DebugControllerDispatcher;