Files
react-native-devtools-frontend/front_end/common/StringOutputStream.js
T
Tim van der Lippe b336f0440a Add import-statements to common/
This removes the need for having a specific ordering of side-effecty
imports in `common.js`. `common/` should now be self-contained as a
whole.

Bug:1006759
Change-Id: I895ad13ce27a01228e9963c317a7b582f4386619
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1899516
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2019-11-07 15:56:40 +00:00

63 lines
930 B
JavaScript

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @interface
*/
export class OutputStream {
/**
* @param {string} data
* @return {!Promise}
*/
async write(data) {
}
/**
* @return {!Promise}
*/
async close() {
}
}
/**
* @implements {OutputStream}
*/
export class StringOutputStream {
constructor() {
this._data = '';
}
/**
* @override
* @param {string} chunk
* @return {!Promise}
*/
async write(chunk) {
this._data += chunk;
}
/**
* @override
*/
async close() {
}
/**
* @return {string}
*/
data() {
return this._data;
}
}
/* Legacy exported object */
self.Common = self.Common || {};
Common = Common || {};
/**
* @interface
*/
Common.OutputStream = OutputStream;
Common.StringOutputStream = StringOutputStream;