mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-30 17:27:22 +08:00
Bug: 1011811 Change-Id: Ie47abb211cdab5b9cfbb88505143a75b41d59394 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2077157 Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
54 lines
789 B
JavaScript
54 lines
789 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.<void>}
|
|
*/
|
|
async write(data) {
|
|
}
|
|
|
|
/**
|
|
* @return {!Promise.<void>}
|
|
*/
|
|
async close() {
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @implements {OutputStream}
|
|
*/
|
|
export class StringOutputStream {
|
|
constructor() {
|
|
this._data = '';
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
* @param {string} chunk
|
|
* @return {!Promise.<void>}
|
|
*/
|
|
async write(chunk) {
|
|
this._data += chunk;
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
* @return {!Promise.<void>}
|
|
*/
|
|
async close() {
|
|
}
|
|
|
|
/**
|
|
* @return {string}
|
|
*/
|
|
data() {
|
|
return this._data;
|
|
}
|
|
}
|