From 426cc38b593a6080aacacb27b23b725465774a35 Mon Sep 17 00:00:00 2001 From: Joey Bloom <15joeybloom@gmail.com> Date: Thu, 28 Nov 2024 12:30:00 -0600 Subject: [PATCH] update helper.js --- lib/js/helper.go | 2 +- lib/js/helper.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/js/helper.go b/lib/js/helper.go index bc1611f3..55078e52 100644 --- a/lib/js/helper.go +++ b/lib/js/helper.go @@ -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{}, } diff --git a/lib/js/helper.js b/lib/js/helper.js index 6cdb186f..3af573dd 100644 --- a/lib/js/helper.js +++ b/lib/js/helper.js @@ -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) } }