mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
bdc5cc4635
* Rename to clarify that it's client-only * Rename FizzStreamer to FizzServer for consistency * Rename react-flight to react-client/flight For consistency with react-server. Currently this just includes flight but it could be expanded to include the whole reconciler. * Add Relay Flight Build * Rename ReactServerHostConfig to ReactServerStreamConfig This will be the config specifically for streaming purposes. There will be other configs for other purposes.
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
export type Destination = ReadableStreamController;
|
|
|
|
export function scheduleWork(callback: () => void) {
|
|
callback();
|
|
}
|
|
|
|
export function flushBuffered(destination: Destination) {
|
|
// WHATWG Streams do not yet have a way to flush the underlying
|
|
// transform streams. https://github.com/whatwg/streams/issues/960
|
|
}
|
|
|
|
export function beginWriting(destination: Destination) {}
|
|
|
|
export function writeChunk(
|
|
destination: Destination,
|
|
buffer: Uint8Array,
|
|
): boolean {
|
|
destination.enqueue(buffer);
|
|
return destination.desiredSize > 0;
|
|
}
|
|
|
|
export function completeWriting(destination: Destination) {}
|
|
|
|
export function close(destination: Destination) {
|
|
destination.close();
|
|
}
|
|
|
|
const textEncoder = new TextEncoder();
|
|
|
|
export function convertStringToBuffer(content: string): Uint8Array {
|
|
return textEncoder.encode(content);
|
|
}
|