I'm currently working my way through the Distinctive Meteor manual and I've hit a roadblock with the illustration found on page 137
var _currentLikeCount = 0;
var _currentLikeCountListeners = new Deps.Dependency();
currentLikeCount = function() {
_currentLikeCountListeners.depend();
return currentLikeCount;
}
Meteor.setInterval(function() {
var postId;
if (Meteor.user() && postId = Session.get('currentPostId')) {
getFacebookLikeCount(Meteor.user(), Posts.find(postId),
function(err, count) {
if (!err && count !== _currentLikeCount) {
_currentLikeCount = count;
_currentLikeCountListeners.changed();
}
});
}
}, 5 * 1000);
I am finding it challenging to grasp the purpose of "Deps.Dependency()" and "depend()" in this code. What functionality is being demonstrated here? This aspect was briefly covered in the book and I am struggling to find a clear explanation in the documentation.