mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
b55d319559
part of https://github.com/facebook/react/pull/26571 merging separately to improve tracking of files renames in git Rename HostConfig files to FiberConfig to clarify they are configs for Fiber and not Fizz/Flight. This better conforms to the naming used in Flight and now Fizz of `ReactFlightServerConfig` and `ReactFizzConfig`
27 lines
763 B
JavaScript
27 lines
763 B
JavaScript
/**
|
|
* 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 = [];
|
|
});
|
|
}
|
|
}
|