Created
September 21, 2014 22:18
-
-
Save addieljuarez/35bea042655b5f01a89d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function inicio (data){ | |
| var seg = data; | |
| function cronometro(){ | |
| if(seg!=0){ | |
| Titanium.API .info(seg); | |
| seg--; | |
| var m = seg/60; | |
| var s = seg % 60; | |
| $.display_lbl.text = " " + parseInt(m) + " m : " + parseInt(s) + " s "; | |
| }else{ | |
| Titanium.API.info("Termino"); | |
| alert("Termino el tiempo"); | |
| clearInterval(test); | |
| } | |
| } | |
| var test = setInterval(cronometro, 1000); | |
| }; | |
| $.start_btn.addEventListener('click', function(e){ | |
| if($.minutos.value != "" || $.segundos.value != ""){ | |
| var totalSeg = function (){ | |
| if($.minutos.value != 0 || $.minutos.value != null){ | |
| var totalTime = (parseInt($.minutos.value) * 60) + parseInt($.segundos.value); | |
| return totalTime; | |
| } | |
| else{ | |
| return $.segundos.value; | |
| } | |
| }; | |
| inicio(totalSeg()); | |
| } | |
| else{ | |
| alert("Campos vacios"); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment