console.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.ConsoleMessage = void 0;
  6. var _instrumentation = require("./instrumentation");
  7. /**
  8. * Copyright (c) Microsoft Corporation.
  9. *
  10. * Licensed under the Apache License, Version 2.0 (the "License");
  11. * you may not use this file except in compliance with the License.
  12. * You may obtain a copy of the License at
  13. *
  14. * http://www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an "AS IS" BASIS,
  18. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. * See the License for the specific language governing permissions and
  20. * limitations under the License.
  21. */
  22. class ConsoleMessage extends _instrumentation.SdkObject {
  23. constructor(page, type, text, args, location) {
  24. super(page, 'console-message');
  25. this._type = void 0;
  26. this._text = void 0;
  27. this._args = void 0;
  28. this._location = void 0;
  29. this._page = void 0;
  30. this._page = page;
  31. this._type = type;
  32. this._text = text;
  33. this._args = args;
  34. this._location = location || {
  35. url: '',
  36. lineNumber: 0,
  37. columnNumber: 0
  38. };
  39. }
  40. page() {
  41. return this._page;
  42. }
  43. type() {
  44. return this._type;
  45. }
  46. text() {
  47. if (this._text === undefined) this._text = this._args.map(arg => arg.preview()).join(' ');
  48. return this._text;
  49. }
  50. args() {
  51. return this._args;
  52. }
  53. location() {
  54. return this._location;
  55. }
  56. }
  57. exports.ConsoleMessage = ConsoleMessage;