Files
react-native-devtools-frontend/front_end/common/StringOutputStream.js
T
Paul Lewis 69d7770a96 [DevTools]: Moves common to ES modules
This CL converts the contents of the common/ folder over to ES modules
from the current custom module system. It includes statements in each
file that will pollute the global namespace, allowing the non-ESM code
to continue working as before.

Bug: 1006759
Change-Id: Ib591e49155000381f85999a5da6c467ad0160996
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816563
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#699728}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e064553334d4b0c925f0b1f0e2e0234be66b71be
2019-09-25 13:14:47 +00:00

63 lines
945 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 {Common.OutputStream}
*/
export default 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;