| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.Object} | 7 * @extends {WebInspector.Object} |
| 8 */ | 8 */ |
| 9 WebInspector.Console = function() | 9 WebInspector.Console = function() |
| 10 { | 10 { |
| 11 /** @type {!Array.<!WebInspector.Console.Message>} */ | 11 /** @type {!Array.<!WebInspector.Console.Message>} */ |
| 12 this._messages = []; | 12 this._messages = []; |
| 13 } | 13 }; |
| 14 | 14 |
| 15 /** @enum {symbol} */ | 15 /** @enum {symbol} */ |
| 16 WebInspector.Console.Events = { | 16 WebInspector.Console.Events = { |
| 17 MessageAdded: Symbol("messageAdded") | 17 MessageAdded: Symbol("messageAdded") |
| 18 } | 18 }; |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * @enum {string} | 21 * @enum {string} |
| 22 */ | 22 */ |
| 23 WebInspector.Console.MessageLevel = { | 23 WebInspector.Console.MessageLevel = { |
| 24 Log: "log", | 24 Log: "log", |
| 25 Warning: "warning", | 25 Warning: "warning", |
| 26 Error: "error" | 26 Error: "error" |
| 27 } | 27 }; |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * @constructor | 30 * @constructor |
| 31 * @param {string} text | 31 * @param {string} text |
| 32 * @param {!WebInspector.Console.MessageLevel} level | 32 * @param {!WebInspector.Console.MessageLevel} level |
| 33 * @param {number} timestamp | 33 * @param {number} timestamp |
| 34 * @param {boolean} show | 34 * @param {boolean} show |
| 35 */ | 35 */ |
| 36 WebInspector.Console.Message = function(text, level, timestamp, show) | 36 WebInspector.Console.Message = function(text, level, timestamp, show) |
| 37 { | 37 { |
| 38 this.text = text; | 38 this.text = text; |
| 39 this.level = level; | 39 this.level = level; |
| 40 this.timestamp = (typeof timestamp === "number") ? timestamp : Date.now(); | 40 this.timestamp = (typeof timestamp === "number") ? timestamp : Date.now(); |
| 41 this.show = show; | 41 this.show = show; |
| 42 } | 42 }; |
| 43 | 43 |
| 44 WebInspector.Console.prototype = { | 44 WebInspector.Console.prototype = { |
| 45 /** | 45 /** |
| 46 * @param {string} text | 46 * @param {string} text |
| 47 * @param {!WebInspector.Console.MessageLevel} level | 47 * @param {!WebInspector.Console.MessageLevel} level |
| 48 * @param {boolean=} show | 48 * @param {boolean=} show |
| 49 */ | 49 */ |
| 50 addMessage: function(text, level, show) | 50 addMessage: function(text, level, show) |
| 51 { | 51 { |
| 52 var message = new WebInspector.Console.Message(text, level || WebInspect
or.Console.MessageLevel.Log, Date.now(), show || false); | 52 var message = new WebInspector.Console.Message(text, level || WebInspect
or.Console.MessageLevel.Log, Date.now(), show || false); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * @return {!Promise.<undefined>} | 95 * @return {!Promise.<undefined>} |
| 96 */ | 96 */ |
| 97 showPromise: function() | 97 showPromise: function() |
| 98 { | 98 { |
| 99 return WebInspector.Revealer.revealPromise(this); | 99 return WebInspector.Revealer.revealPromise(this); |
| 100 }, | 100 }, |
| 101 | 101 |
| 102 __proto__: WebInspector.Object.prototype | 102 __proto__: WebInspector.Object.prototype |
| 103 } | 103 }; |
| 104 | 104 |
| 105 WebInspector.console = new WebInspector.Console(); | 105 WebInspector.console = new WebInspector.Console(); |
| OLD | NEW |