-
-
Save Hawksbillcat/5d2bd6f7274545a89d4690a1bc238b58 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
presentLoadingText() { | |
let start=2000; | |
let count=0; | |
let scanTime; | |
let deadTimer; | |
//////////////////////////////////////// | |
let startLoad=()=>{ | |
loadBar(); | |
return this.load.present(); | |
} | |
let loadBar=()=>{ | |
if(this.load&&this.load.instance){ | |
stopLoader(); | |
} | |
this.load=this.loading.create({ | |
content: 'Loading Please Wait...' | |
}); | |
} | |
let stopLoader=()=>{ | |
this.load.dismissAll(); | |
this.load=null; | |
} | |
///////////////////////////////////// | |
//this.Loading.present(); | |
let start_Scan=()=>{ | |
startLoad(); | |
scanTime=setInterval(scan,start) | |
} | |
let scan=()=>{//判斷式應該是寫在這 | |
console.log(this.irislist.length) | |
if(this.irislist.length==0){ | |
++count; | |
if(count==5){ | |
startDeadTimer(); | |
count=0; | |
}else{ | |
endDeadTimer(); | |
} | |
}else{ | |
console.log("IRIS DETECTED") | |
endScan(); | |
} | |
} | |
let endScan=()=>{ | |
console.log("scan cancelled") | |
clearInterval(scanTime) | |
stopLoader(); | |
} | |
let startDeadTimer=()=> { | |
deadTimer = setTimeout(() => { | |
//endScan(); | |
clearInterval(scanTime) | |
deadTimer = null; | |
console.log('[Hint] hide loading bar and show confirm here'); | |
let alert = this.alertctrl.create({ | |
title: 'Confirm Waiting...', | |
message: 'No IRIS detected... <br> keep waiting?', | |
buttons: [ | |
{ | |
text: 'Cancel', | |
role: 'cancel', | |
handler: () => { | |
console.log('Cancel clicked'); | |
endScan(); | |
} | |
}, | |
{ | |
text: 'Yes', | |
handler: () => { | |
start_Scan(); | |
} | |
} | |
] | |
}); | |
alert.present(); | |
//confirm('keep waiting?') ? start_Scan() : endScan(); | |
}, 500); | |
} | |
let endDeadTimer=()=> { | |
clearTimeout(deadTimer); | |
deadTimer = null; | |
} | |
start_Scan(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment