| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | |
| 5 /** | 4 /** |
| 6 * @interface | 5 * @interface |
| 7 */ | 6 */ |
| 8 WebInspector.OutputStream = function() | 7 WebInspector.OutputStream = function() {}; |
| 9 { | |
| 10 }; | |
| 11 | 8 |
| 12 WebInspector.OutputStream.prototype = { | 9 WebInspector.OutputStream.prototype = { |
| 13 /** | 10 /** |
| 14 * @param {string} data | 11 * @param {string} data |
| 15 * @param {function(!WebInspector.OutputStream)=} callback | 12 * @param {function(!WebInspector.OutputStream)=} callback |
| 16 */ | 13 */ |
| 17 write: function(data, callback) { }, | 14 write: function(data, callback) {}, |
| 18 | 15 |
| 19 close: function() { } | 16 close: function() {} |
| 20 }; | 17 }; |
| 21 | 18 |
| 22 /** | 19 /** |
| 23 * @constructor | |
| 24 * @implements {WebInspector.OutputStream} | 20 * @implements {WebInspector.OutputStream} |
| 21 * @unrestricted |
| 25 */ | 22 */ |
| 26 WebInspector.StringOutputStream = function() | 23 WebInspector.StringOutputStream = class { |
| 27 { | 24 constructor() { |
| 28 this._data = ""; | 25 this._data = ''; |
| 26 } |
| 27 |
| 28 /** |
| 29 * @override |
| 30 * @param {string} chunk |
| 31 * @param {function(!WebInspector.OutputStream)=} callback |
| 32 */ |
| 33 write(chunk, callback) { |
| 34 this._data += chunk; |
| 35 } |
| 36 |
| 37 /** |
| 38 * @override |
| 39 */ |
| 40 close() { |
| 41 } |
| 42 |
| 43 /** |
| 44 * @return {string} |
| 45 */ |
| 46 data() { |
| 47 return this._data; |
| 48 } |
| 29 }; | 49 }; |
| 30 | |
| 31 WebInspector.StringOutputStream.prototype = { | |
| 32 /** | |
| 33 * @override | |
| 34 * @param {string} chunk | |
| 35 * @param {function(!WebInspector.OutputStream)=} callback | |
| 36 */ | |
| 37 write: function(chunk, callback) | |
| 38 { | |
| 39 this._data += chunk; | |
| 40 }, | |
| 41 | |
| 42 /** | |
| 43 * @override | |
| 44 */ | |
| 45 close: function() | |
| 46 { | |
| 47 }, | |
| 48 | |
| 49 /** | |
| 50 * @return {string} | |
| 51 */ | |
| 52 data: function() | |
| 53 { | |
| 54 return this._data; | |
| 55 } | |
| 56 }; | |
| OLD | NEW |