/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-reconciler/src/ReactPostPaintCallback.js
26 строк
763 B
Josh Story
Rename HostConfig files to FiberConfig to clarify they are configs fo… (#26592)
11 апр 2023, 00:58
Не верифицирован
11 апр 2023, 00:58
b55d319
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and 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 {requestPostPaintCallback} from './ReactFiberConfig'; let postPaintCallbackScheduled = false; let callbacks: Array<any | ((endTime: number) => void)> = []; export function schedulePostPaintCallback(callback: (endTime: number) => void) { callbacks.push(callback); if (!postPaintCallbackScheduled) { postPaintCallbackScheduled = true; requestPostPaintCallback(endTime => { for (let i = 0; i < callbacks.length; i++) { callbacks[i](endTime); } postPaintCallbackScheduled = false; callbacks = []; }); } }