white-screen-monitor
v0.1.0
Published
Use the [document.elementFromPoint](https://developer.mozilla.org/en-US/docs/Web/API/Document/elementFromPoint) API to detecte white screen according to the check time parameter, and then call the callback function.
Downloads
2
Readme
White screen monitor
Use the document.elementFromPoint API to detecte white screen according to the check time parameter, and then call the callback function.
Distribution of detection points:
Installing
npm install white-screen-monitor
or
yarn add white-screen-monitor
Example
import WhiteScreenMonitor from 'white-screen-monitor';
const whiteScreenMonitor = WhiteScreenMonitor.create(
// callback function
console.log,
{
// container elements, optional
containerElements: ['html', 'body', 'div#app', 'div#root']
/** check time,optional */
checkList: [250, 250, 250, 250, 500, 500, 1000, 1000, 2000];
/** Is there a skeleton screen available,optional */
skeletonProject: false;
}
)
window.onload(() => {
whiteScreenMonitor.test() // logger: {status: 'ok' | 'error', elements: ['body', 'div#app'], checkTimes: 3}
})