
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
blankscreen
Advanced tools
白屏监控组件,支持多实例,默认支持全屏白屏监控,和 React 组件白屏监控。
blankscreen 内置了全屏白屏监控,引入 blankscreen 后,只需要复写 onError, onSuccess 方法即可。
import BlankScreen from 'blankscreen';
BlankScreen.onError = function(err) {
console.log('full-page blank screen', err);
};
BlankScreen.onSuccess = function(meta) {
console.log('full-page OK', meta);
};
blankscreen 还内置了 React 组件,包含待检查的组件外部即可检查内部是否处于白屏状态。
import ReactBlankScreen from 'blankscreen/lib/react';
render() {
return (
<ReactBlankScreen
rule-text={10}
onError={this.onError}
onSuccess={this.onSuccess}
autoStart
>
<div></div>
</ReactBlankScreen>
);
}
如果组件需要异步检查,不设置 autoStart 或设置为 false,然后通过 ref 主动调用 start() 方法启动检查。
import ReactBlankScreen from 'blankscreen/lib/react';
componentDidMount() {
setTimeout(() => {
this.refs.blankscreen.start();
}, 1000);
}
render() {
return (
<ReactBlankScreen
ref="blankscreen"
rule-text={10}
onError={this.onError}
onSuccess={this.onSuccess}
>
<div></div>
</ReactBlankScreen>
);
}
import BaseBlankScreen from 'blankscreen/lib/base';
const bs = new BaseBlankScreen(element, {
rule: {
text: 0,
},
onError: err => console.error(err),
onSuccess: meta => console.log(meta),
autoStart: true,
})
bs.start();
| 文字\元素 | 有 | 无 |
|---|---|---|
| 有 | 黑 | 黑 |
| 无 | 白 | 白 |
原则上,只通过是否有指定个数的『文字』来判定是否白屏, 子元素个数多少不作为判定条件,只作为附加信息。
注:
开始检查白屏,白屏时间从此时开始计算。
停止检查。超时(6s)或离开页面时自动停止检查。
注:终止后会判定是否白屏,得到判定结果后,不可再次启动检查。
可复写的白屏处理函数。判定为白屏时会调用 onError 函数。
err:
可复写的非白屏处理函数,最终判定为非白屏,会调用 onSuccess 函数。
meta:

FAQs
BlankScreen
The npm package blankscreen receives a total of 0 weekly downloads. As such, blankscreen popularity was classified as not popular.
We found that blankscreen demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.