Permalink
Browse files

use process.nextTick when available

  • Loading branch information...
1 parent d2bca3f commit 09eda2bf1e7764a4b6d2874c63d5c9de2ea000b5 @mental committed Jan 18, 2011
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/Actor.coffee
View
@@ -3,8 +3,15 @@ WebActors = if require? and exports?
else
@WebActors ?= {}
-nextTick = (cb) ->
- setTimeout(cb, 0)
+if require?
+ try
+ nextTick = require('process').nextTick
+ catch e
+ null
+
+unless nextTick?
+ nextTick = (cb) ->
+ setTimeout(cb, 0)
class NullActor
constructor: ->

0 comments on commit 09eda2b

Please sign in to comment.