aligos
February 24, 2016, 6:14am
1
I tried to make pomodoro using meteor todo example, when i click button pomodoro-start the timer runs in 1 minute (pomodoroTime) and will automatically switch into (breakTime) 0.5 minute.
I want when Breaktime finished, everything stopped as when I click the button pomodoro-stop
Template.pomodoro.events({
'click .pomodoro-start': function( e ) {
var _id = Todos.findOne(this._id)._id;
//console.log(_id);
var listId = Todos.findOne(this._id).listId;
//console.log(listId);
var checked = $(event.target).is(':checked');
if ( ! Session.get( 'pomodoroTimer' ) ) {
Session.set( 'pomodoroTimer', setInterval( function() {
var CBT = Session.get( 'totalTime' ).fromTimerFormat();
//console.log(CBT);
currentPomodoroTime = Session.get( 'currentPomodoroTime' ).fromTimerFormat();
if ( currentPomodoroTime == 0 ) {
breakTime();
if ( CBT == 300 && currentPomodoroTime == 0 ) {
var timerPomo = POMODORO_TIME.toTimerFormat();
Session.set( 'timerType', timerPomo );
Session.set( 'totalTime', timerPomo );
Session.set( 'currentPomodoroTime', timerPomo );
clearInterval( Session.get( 'pomodoroTimer' ) );
Session.set( 'pomodoroTimer', false );