mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-17 07:41:35 +03:00
Preload IntlSegmenter polyfill if needed
This commit is contained in:
parent
5246af4ae9
commit
ebd9f05f69
1 changed files with 9 additions and 0 deletions
|
@ -6,6 +6,15 @@ import Loader from './loader';
|
||||||
|
|
||||||
const supportsIntlSegmenter = !shouldPolyfill();
|
const supportsIntlSegmenter = !shouldPolyfill();
|
||||||
|
|
||||||
|
// Preload IntlSegmenter
|
||||||
|
setTimeout(() => {
|
||||||
|
queueMicrotask(() => {
|
||||||
|
if (!supportsIntlSegmenter) {
|
||||||
|
import('@formatjs/intl-segmenter/polyfill-force').catch(() => {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
export default function IntlSegmenterSuspense({ children }) {
|
export default function IntlSegmenterSuspense({ children }) {
|
||||||
if (supportsIntlSegmenter) {
|
if (supportsIntlSegmenter) {
|
||||||
return <Suspense fallback={<Loader />}>{children}</Suspense>;
|
return <Suspense fallback={<Loader />}>{children}</Suspense>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue