/
githubmirror
/
docusaurus
Обзор
Документация
Войти
/
githubmirror
/
docusaurus
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/docusaurus-plugin-pwa/src/renderReloadPopup.tsx
29 строк
912 B
Sébastien Lorber
chore: upgrade minor dependencies (#10610)
24 окт 2024, 19:44
Не верифицирован
24 окт 2024, 19:44
28f6a49
Код
Авторство
О чём код?
/** * 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. */ import React from 'react'; import {createRoot} from 'react-dom/client'; import type {Props} from '@theme/PwaReloadPopup'; const POPUP_CONTAINER_ID = 'pwa-popup-container'; const getContainer = () => document.getElementById(POPUP_CONTAINER_ID); const createContainer = () => { const container = document.createElement('div'); container.id = POPUP_CONTAINER_ID; document.body.appendChild(container); return container; }; export function renderReloadPopup(props: Props): Promise<void> { const container = getContainer() ?? createContainer(); return import('@theme/PwaReloadPopup').then(({default: ReloadPopup}) => { const root = createRoot(container); root.render(<ReloadPopup {...props} />); }); }