Skip to content

Commit

Permalink
update helper.js
Browse files Browse the repository at this point in the history
  • Loading branch information
15joeybloom committed Nov 28, 2024
1 parent fd8fd55 commit 426cc38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/js/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ var WaitIdle = &Function{
// WaitLoad ...
var WaitLoad = &Function{
Name: "waitLoad",
Definition: `function(){const n=this===window;return new Promise((e,t)=>{if(n){if("complete"===document.readyState)return e();window.addEventListener("load",_=>e())}else void 0===this.complete||this.complete?e():(this.addEventListener("load",_=>e()),this.addEventListener("error",t))})}`,
Definition: `function(){const n=this===window;return new Promise((t,e)=>{if(n){if("complete"===document.readyState)return t();window.addEventListener("load",e=>t())}else void 0===this.complete||this.complete?t():(this.addEventListener("load",e=>t()),this.addEventListener("error",e))})}`,
Dependencies: []*Function{},
}

Expand Down
4 changes: 2 additions & 2 deletions lib/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ const functions = {
return new Promise((resolve, reject) => {
if (isWin) {
if (document.readyState === 'complete') return resolve()
window.addEventListener('load', resolve)
window.addEventListener('load', _=>resolve())
} else {
if (this.complete === undefined || this.complete) {
resolve()
} else {
this.addEventListener('load', resolve)
this.addEventListener('load', _=>resolve())
this.addEventListener('error', reject)
}
}
Expand Down

0 comments on commit 426cc38

Please sign in to comment.