We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 28bfe37 commit 4182da3Copy full SHA for 4182da3
src/base.js
@@ -33,17 +33,17 @@ class BlankScreen {
33
this.onError = options.onError;
34
this.onSuccess = options.onSuccess;
35
36
+ if (options.autoStart) {
37
+ this.start();
38
+ }
39
+
40
// 离开页面时,检查白屏。
41
window.addEventListener('beforeunload', () => {
42
this.stop();
43
}, false);
44
window.addEventListener('unload', () => {
45
46
-
- if (options.autoStart) {
- this.start();
- }
47
}
48
49
/*
@@ -110,6 +110,8 @@ class BlankScreen {
110
111
112
stop() {
113
+ // 没开始的实例(如异步启动但未启动),离开页面时不检查白屏。
114
+ if (typeof this._state === 'undefined') { return; }
115
this._state = 'stop';
116
clearTimeout(this._timer);
117
this.loop();
0 commit comments