浏览代码

jsre: timer bugfix when clearInterval was called from within the callback

Bas van Kervel 10 年之前
父节点
当前提交
2f65ddc501
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      jsre/jsre.go

+ 3 - 1
jsre/jsre.go

@@ -154,7 +154,9 @@ loop:
 			if err != nil {
 				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)
 			} else {
 				delete(registry, timer)