Permalink
Browse files

Fixed another edge case

  • Loading branch information...
assaf committed Aug 23, 2012
1 parent 689582b commit 9901ab938ee593b1979d5fea83fb7541bc853ef5
Showing with 16 additions and 5 deletions.
  1. +9 −1 CHANGELOG.md
  2. +7 −4 lib/zombie/eventloop.coffee
View
@@ -2,7 +2,15 @@ zombie.js-changelog(7) -- Changelog
===================================
-## Version 1.4.0 2012-08-20
+## Version 1.4.1 2012-08-22
+
+Fixed another timer edge case.
+
+ 550 tests
+ 14.5 sec to complete
+
+
+## Version 1.4.0 2012-08-22
Support for browser custom headers ():
@@ -29,8 +29,6 @@ class EventLoop
apply: (window)->
# Remove timer.
remove = (timer)=>
- # Make sure we don't resume it
- timer.next = null
index = @_timers.indexOf(timer)
@_timers.splice(index, 1) if ~index
@@ -46,6 +44,7 @@ class EventLoop
return if timer.handle
timer.next = Date.now() + Math.max(delay || 0, 0)
if delay <= 0
+ # Something weird happens if we use setTimeout(fn, 0), seems that the timer never fires
remove(timer)
@perform (done)=>
process.nextTick =>
@@ -210,16 +209,20 @@ class EventLoop
_next: ->
for waiting in @_waiting
process.nextTick waiting
+ return
# Pause any timers from firing while we're not listening.
_pause: ->
- for timer in @_timers when timer.next
+ for timer in @_timers
timer.pause()
+ return
# Resumes any timers.
_resume: ->
- for timer in @_timers when timer.next
+ # Note: timer.resume modifies _timers
+ for timer in @_timers.slice()
timer.resume()
+ return
dump: ->
return [ "The time: #{new Date}",

0 comments on commit 9901ab9

Please sign in to comment.