I am trying to prevent clicks that happen within 3 secs of the last click. Currently my onClicked()
function isn’t working properly. What is wrong with my logic?
html
<ion-content (tap)=onClicked($event)>
</ion-content>
component
onClicked(event) {
let newClick = new Date().getTime();
let oldClick = 0;
if((newClick - oldClick) < 3000) {
oldClick = newClick;
return false;
}
else {
this.doSomething();
oldClick = newClick;
}