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.
33 lines
710 B
JavaScript
33 lines
710 B
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
|
|
*/
|
|
|
|
import type {ReactNodeList} from 'shared/ReactTypes';
|
|
|
|
import {
|
|
createRequest,
|
|
startWork,
|
|
startFlowing,
|
|
} from 'react-server/src/ReactFizzServer';
|
|
|
|
function renderToReadableStream(children: ReactNodeList): ReadableStream {
|
|
let request;
|
|
return new ReadableStream({
|
|
start(controller) {
|
|
request = createRequest(children, controller);
|
|
startWork(request);
|
|
},
|
|
pull(controller) {
|
|
startFlowing(request);
|
|
},
|
|
cancel(reason) {},
|
|
});
|
|
}
|
|
|
|
export {renderToReadableStream};
|