javascript - How to get the running time in the timer after pause on page change using angular2 and typescript -
i have timer working fine when pause , resume works fine on same page. if change page , come timer page, timer restart paused time not running time though been resumed long time. please help.
timer.ts
this.apiservice .runningentries(user.user._id) .subscribe( entries => { if(entries.current) { var milisecond = entries.current.ms; var second = parseint(milisecond) / 1000; second = parseint(second.tofixed(2)) if(second< 0) { second = 0; } this.start = second if(this.timerservice.start == 0 ) { this.timerservice.start = this.start; } this.timerservice.start = this.start; var length = entries.current.times.length; var last_entry = entries.current.times[length - 1]; if((last_entry.state == 'start') || (last_entry.state == 'resume')) { this.starttimer(); } else if(last_entry.state == 'pause') { this.pauseinittimer(); } }
Comments
Post a Comment