Professional Documents
Culture Documents
1
* react-dom-unstable-fizz.browser.development.js
*
* 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.
*/
'use strict';
function scheduleWork(callback) {
callback();
}
function flushBuffered(destination) {// WHATWG Streams do not yet have a way to
flush the underlying
// transform streams. https://github.com/whatwg/streams/issues/960
}
function writeChunk(destination, buffer) {
destination.enqueue(buffer);
return destination.desiredSize > 0;
}
function close(destination) {
destination.close();
}
var textEncoder = new TextEncoder();
function convertStringToBuffer(content) {
return textEncoder.encode(content);
}
function performWork(request) {
var element = request.children;
request.children = null;
request.completedChunks.push(formatChunk(type, props));
if (request.flowing) {
flushCompletedChunks(request);
}
flushBuffered(request.destination);
}
function flushCompletedChunks(request) {
var destination = request.destination;
var chunks = request.completedChunks;
request.completedChunks = [];
try {
for (var i = 0; i < chunks.length; i++) {
var chunk = chunks[i];
writeChunk(destination, chunk);
}
} finally {
}
close(destination);
}
function startWork(request) {
request.flowing = true;
scheduleWork(function () {
return performWork(request);
});
}
function startFlowing(request) {
request.flowing = false;
flushCompletedChunks(request);
}
function renderToReadableStream(children) {
var request;
return new ReadableStream({
start: function (controller) {
request = createRequest(children, controller);
startWork(request);
},
pull: function (controller) {
startFlowing(request);
},
cancel: function (reason) {}
});
}
var ReactDOMFizzServerBrowser = {
renderToReadableStream: renderToReadableStream
};
return unstableFizz_browser;
})));