How to stop timer.setinterval with a tap event or leaving page in nativescript
问题 I have an counter that loads when starts when a page is loaded and stops when the time == 0 fires a dialog and navigates to another page. But i also want to stop it when the use taps a button or when he gives up and leave the page. Below is my code for starting the timer and ending it when the time === 0 var timeKeep = vm.time; var count = 0; countId = timer.setInterval(() => { timeCountDown(); count += 1; if (count === timeKeep) { timer.clearInterval(countId); dialogs.alert({ message: "Time