mirror of https://github.com/vuejs/core.git
fix(hydration): provide compat fallback for idle callback hydration strategy (#11935)
This commit is contained in:
parent
05685a9d7c
commit
1ae545a378
|
@ -1,6 +1,13 @@
|
||||||
import { isString } from '@vue/shared'
|
import { getGlobalThis, isString } from '@vue/shared'
|
||||||
import { DOMNodeTypes, isComment } from './hydration'
|
import { DOMNodeTypes, isComment } from './hydration'
|
||||||
|
|
||||||
|
// Polyfills for Safari support
|
||||||
|
// see https://caniuse.com/requestidlecallback
|
||||||
|
const requestIdleCallback: Window['requestIdleCallback'] =
|
||||||
|
getGlobalThis().requestIdleCallback || (cb => setTimeout(cb, 1))
|
||||||
|
const cancelIdleCallback: Window['cancelIdleCallback'] =
|
||||||
|
getGlobalThis().cancelIdleCallback || (id => clearTimeout(id))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A lazy hydration strategy for async components.
|
* A lazy hydration strategy for async components.
|
||||||
* @param hydrate - call this to perform the actual hydration.
|
* @param hydrate - call this to perform the actual hydration.
|
||||||
|
|
Loading…
Reference in New Issue