src -> packages

This commit is contained in:
草鞋没号
2022-02-08 10:34:14 +08:00
parent c0b257f794
commit 9d702430f0
22 changed files with 25 additions and 19 deletions

15
packages/preload/utils.ts Normal file
View File

@@ -0,0 +1,15 @@
/** docoment ready */
export function domReady(condition: DocumentReadyState[] = ['complete', 'interactive']) {
return new Promise(resolve => {
if (condition.includes(document.readyState)) {
resolve(true)
} else {
document.addEventListener('readystatechange', () => {
if (condition.includes(document.readyState)) {
resolve(true)
}
})
}
})
}