mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-30 01:43:36 +08:00
R=szuend@chromium.org Bug: 1222126 Change-Id: I5622067436b438937247fb67b3e5f9f8268989dd Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3207875 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Simon Zünd <szuend@chromium.org>
27 lines
578 B
TypeScript
27 lines
578 B
TypeScript
// 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.
|
|
|
|
export interface OutputStream {
|
|
write(data: string): Promise<void>;
|
|
close(): Promise<void>;
|
|
}
|
|
|
|
export class StringOutputStream implements OutputStream {
|
|
#dataInternal: string;
|
|
constructor() {
|
|
this.#dataInternal = '';
|
|
}
|
|
|
|
async write(chunk: string): Promise<void> {
|
|
this.#dataInternal += chunk;
|
|
}
|
|
|
|
async close(): Promise<void> {
|
|
}
|
|
|
|
data(): string {
|
|
return this.#dataInternal;
|
|
}
|
|
}
|