What is the difference between Meteor.autorun
and Tracker.autorun
?
I'm well aware of the difference in using this.autorun
in template lifecycle callbacks, but have seen these two used interchangeably and just want to be sure I haven't missed a trick.
Well, it can easily be found out with the identity operator.
This will be false
because it is not the same function:
(function() {} === function() {})
Let's try with the two autorun
:
(Meteor.autorun === Tracker.autorun)
This returns true
. So yes it's only a pure alias.
However, only Tracker.autorun
is documented. I suspect some kind of old API left for compatibility...
Let's check some Meteor code on GitHub!
File :
deprecated.js
Meteor.autorun = Tracker.autorun;
This is in deprecated.js
, it says some things about //Deprecated functions
and some backward compatibility with Meteor 0.5.4. It seems pretty clear which one you should use.
You can find some other old timers in there, such as Deps
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With