mrchimp/Tock — pull request #5 by kara-todd (2013-10-28 02:43:29+00:00)
Title: Fix stop/reset bug when there are multiple instances of a timer on the same page.

I ran into a problem where if you call reset() or stop() with multiple timers running it will actually stop all of them. :)

This is because the setTimeout ID returns just an incremented number. After the first timeout was stopped it would then stop the second occurrence of the timer. To solve this issue I added a prefix which adds a unique id to each timer instance.

I was also having issues with clicking "reset" borking the time of the other timers. Adding start_time, time, and elapsed as private variables seemed to fix this issue. I don't think it broke anything. ;)