/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
fixtures/ssr/src/components/Suspend.js
22 строки
528 B
Sebastian Markbåge
[Fizz] Wire up the Fixture (#21273)
23 апр 2021, 01:00
Не верифицирован
23 апр 2021, 01:00
af5037a
Код
Авторство
О чём код?
let promise = null; let isResolved = false; export default function Suspend({children}) { // This will suspend the content from rendering but only on the client. // This is used to demo a slow loading app. if (!isResolved) { if (promise === null) { promise = new Promise(resolve => { setTimeout( () => { isResolved = true; resolve(); }, typeof window === 'object' ? 6000 : 1000 ); }); } throw promise; } return children; }