getKeyDependencies
Return the observable objects that compute to the value of a named property on an object
getKeyDependencies(obj, key)
Return the observable objects that provide input values to generate the computed value of the
property key
on Map-like object obj
. If key
does not have dependencies on obj
, returns undefined
.
Otherwise returns an object with up to two keys: keyDependencies
is a [can-util/js/cid-map/cid-map CIDMap] that
maps each Map-like object providing keyed values to an Array of the relevant keys; valueDependencies
is a
[can-util/js/cid-set/cid-set CIDSet] that contains all Value-like dependencies providing their own values.
obj
must implement @@can.getKeyDependencies to work with
canReflect.getKeyDependencies
.
var foo = new DefineMap({ "bar": "baz" })
var obj = new (DefineMap.extend({
baz: {
get: function() {
return foo.bar;
}
}
}))();
canReflect.getKeyDependencies(obj, "baz"); // -> { valueDependencies: CIDSet }
Parameters
- obj
{Object}
:the object to check for key dependencies
- key
{String}
:the key on the object to check
Returns
{Object}
:
the observable values that this keyed value depends on