       @firstRun = false
       if errored
         @stop()
-  
+
   onInvalidate: (f) ->
     if typeof f != "function"
       throw new Error("onInvalidate requires a function")
-    
+
     f = Tracker._makeNonreactive(Meteor.bindEnvironment(f, null, @))
-    
+
     if @invalidated
       f()
     else
       @_onInvalidateCallbacks.push(f)
-    
+
   invalidate: ->
     if not @invalidated
       if not @_recomputing and not @stopped
         queue.queueTask =>
           @._recompute()
           Tracker._postRun()
-      
+
       @invalidated = true
-      
+
       for callback in @_onInvalidateCallbacks
         callback()
       @_onInvalidateCallbacks = []
-  
+
   stop: ->
     if not @stopped
       @stopped = true
       @invalidate()
-      
+
   _compute: ->
     @invalidated = false
     @._func(@)
-    
+
   _recompute: ->
     @_recomputing = true
     while @invalidated and not @stopped

        f()
      catch e
        console.log "Exception from Tracker afterFlush function:", e.stack || e.message
  
  autorun: (f) ->
    c = new Tracker.Computation(f, Tracker.currentComputation, privateObj)
    
    if Tracker.active
      Tracker.onInvalidate -> c.stop()
      
    c
  
  nonreactive: (f) ->
    Tracker.currentComputationVar.withValue null, f
  
  _makeNonreactive: (f) ->
    if f.$isNonreactive
      return f

  constructor: (f, @_parent, p)->
    if p != privateObj
      throw new Error("Tracker.Computation constructor is private; use Tracker.autorun")

    @stopped = false
    @invalidated = false
    @firstRun = true
    @_id = nextId++
    @_onInvalidateCallbacks = []
    @_recomputing = false

    Tracker.currentComputationVar.withValue @, =>
      @_func = Meteor.bindEnvironment(f, null, @)

    errored = true
    try
      @._compute()
