define(["lib/meteor"], function(meteor) {
"use strict";
var Deps = meteor.deps.Deps;
/**
* Creates a dependency map.
*
* @class Manages a group of Deps.Dependecy objects. Allows you to call
* depend() and changed() with a name instead of a reference.
*
* @name DepMap
* @private
*/
var DepMap = function() {
/** @alias DepMap.prototype */
var self = {};
var deps = {};
/**
* Causes the current computation to depend on the dependency with the
* given name.
*/
self.depend = function(name) {
if(deps[name] === undefined) {
deps[name] = new Deps.Dependency();
}
deps[name].depend();
};
/**
* Marks the dependency with the given name as changed.
*/
self.changed = function(name) {
if(deps[name]) {
deps[name].changed();
}
};
return self;
};
return DepMap;
});