Posted: 6 Mar 2018 15:48 EST Last activity: 12 Mar 2018 8:00 EDT
Need to pause and resume timer in Interaction while toggling between two interaction
Need to pause and resume timer in Interaction while toggling between two interaction.
Anybody customized CPMCallTimer to achieve this.
The timer should pause if we are working on another interaction in another tab. when the focus comes back then the clock should resume.
You might note the time when you switch away from the active tab and introduce a new variable to "this" which contains the time you switch away, say "this._timeSwitchAway". Then, when you enter this same bit of code again, look to see if this._timeSwitchAway exits, and if it does, add to the start time "currentTime - this._timeSwitchAway." Then clear this._timeSwitchAway.
For example, if the timer started exactly 1 1PM, and at 1:30 PM you went to another tab for 5 minutes, this._timeSwitchAway would be 1:30. If you came back at 1:35, you would compute a 5 minute differential, and add it to the start time, so the new start time would be 1:35. In essence, you eliminated the time spent switched away.
There will be a few details that you'll need to figure out (i.e., how to determine when you are leaving the current tab), but I think this will work.