/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
v16.14.0
packages/react-client/src/ReactFlightClientHostConfigBrowser.js
32 строки
699 B
Sebastian Markbåge
[Flight] Split Streaming from Relay Implemenation (#18260)
11 мар 2020, 00:55
Не верифицирован
11 мар 2020, 00:55
99d7371
Код
Авторство
О чём код?
/** * 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 StringDecoder = TextDecoder; export const supportsBinaryStreams = true; export function createStringDecoder(): StringDecoder { return new TextDecoder(); } const decoderOptions = {stream: true}; export function readPartialStringChunk( decoder: StringDecoder, buffer: Uint8Array, ): string { return decoder.decode(buffer, decoderOptions); } export function readFinalStringChunk( decoder: StringDecoder, buffer: Uint8Array, ): string { return decoder.decode(buffer); }