Merge pull request #1811 from bas-vk/timer-clearinterval

timer bugfix when clearInterval was called from within the callback
This commit is contained in:
Felix Lange 2015-09-17 19:21:49 +02:00
commit 69f48e4689
1 changed files with 3 additions and 1 deletions

View File

@ -154,7 +154,9 @@ loop:
if err != nil { if err != nil {
fmt.Println("js error:", err, arguments) fmt.Println("js error:", err, arguments)
} }
if timer.interval {
_, inreg := registry[timer] // when clearInterval is called from within the callback don't reset it
if timer.interval && inreg {
timer.timer.Reset(timer.duration) timer.timer.Reset(timer.duration)
} else { } else {
delete(registry, timer) delete(registry, timer)