Documentation Index
Fetch the complete documentation index at: https://mintlify.com/meteor/meteor/llms.txt
Use this file to discover all available pages before exploring further.
Tracker API
Tracker is Meteor’s reactivity system. It allows you to automatically rerun functions when data changes. Source:packages/tracker/tracker.js
Core Functions
Tracker.autorun()
Run a function now and rerun it later whenever its dependencies change. Returns a Computation object that can be used to stop or observe the rerunning. Locus: ClientThe function to run. It receives one argument: the Computation object that will be returned.
Optional options object.
Optional function to run when an error happens in the Computation. The only argument it receives is the Error thrown. Defaults to the error being logged to the console.
Tracker.Computation
Tracker.nonreactive()
Run a function without tracking dependencies. Locus: ClientA function to call immediately.
Tracker.flush()
Process all reactive updates immediately and ensure that all invalidated computations are rerun. Locus: ClientTracker.onInvalidate()
Registers a newonInvalidate callback on the current computation, to be called immediately when the current computation is invalidated or stopped.
Locus: Client
A callback function that will be invoked as
func(c), where c is the computation on which the callback is registered.Tracker.afterFlush()
Schedules a function to be called during the next flush, or later in the current flush if one is in progress, after all invalidated computations have been rerun. Locus: ClientA function to call at flush time.
Tracker.Computation
A Computation object represents code that is repeatedly rerun in response to reactive data changes.Properties
True if this computation has been stopped.
True if this computation has been invalidated (and not yet rerun), or if it has been stopped.
True during the initial run of the computation at the time
Tracker.autorun is called, and false on subsequent reruns and at other times.Methods
computation.stop()
Prevents this computation from rerunning. Locus: Clientcomputation.invalidate()
Invalidates this computation so that it will be rerun. Locus: Clientcomputation.onInvalidate()
Registers a callback to run when this computation is next invalidated, or runs it immediately if the computation is already invalidated. Locus: ClientFunction to be called on invalidation. Receives one argument: the computation that was invalidated.
computation.onStop()
Registers a callback to run when this computation is stopped, or runs it immediately if the computation is already stopped. Locus: ClientFunction to be called on stop. Receives one argument: the computation that was stopped.
computation.flush()
Process the reactive updates for this computation immediately and ensure that the computation is rerun. Locus: Clientcomputation.run()
Causes the function inside this computation to run and synchronously process all reactive updates. Locus: ClientTracker.Dependency
A Dependency represents an atomic unit of reactive data that a computation might depend on.Constructor
Methods
dependency.depend()
Declares that the current computation depends on this dependency. Locus: ClientAn optional computation declared to depend on this dependency instead of the current computation.
boolean - True if the computation is a new dependent of this dependency rather than an existing one.
dependency.changed()
Invalidate all dependent computations immediately and remove them as dependents. Locus: Clientdependency.hasDependents()
True if this Dependency has one or more dependent Computations. Locus: Client Returns:boolean
Tracker.active
True if there is a current computation. Locus: Client Type:boolean
Tracker.currentComputation
The current computation, ornull if there isn’t one.
Locus: Client
Type: Tracker.Computation