Permalink
Browse files

factor out use of setTimeout

  • Loading branch information...
1 parent 1f7e8bd commit aaaf51479e0b95999674c7a8403298450a4bb4b3 @mental committed Jan 18, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/Actor.coffee
View
@@ -3,6 +3,9 @@ WebActors = if require? and exports?
else
@WebActors ?= {}
+nextTick = (cb) ->
+ setTimeout(cb, 0)
+
class NullActor
constructor: ->
@actor_id = null
@@ -61,7 +64,7 @@ class LocalActor
cont = receiver(message)
if cont
@receivers = []
- setTimeout(@wrap_cont(cont), 0)
+ nextTick(@wrap_cont(cont))
return true
return false
@@ -98,7 +101,7 @@ class LocalActor
start: (body) ->
register_actor @actor_id, this
- setTimeout(@wrap_cont(body), 0)
+ nextTick(@wrap_cont(body))
shutdown: (reason) ->
@killed = true

0 comments on commit aaaf514

Please sign in to comment.