can-reflect
Advanced tools
Comparing version 1.9.0 to 1.10.0
{ | ||
"name": "can-reflect", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"description": "reflection on unknown data types", | ||
@@ -5,0 +5,0 @@ "homepage": "http://canjs.com", |
@@ -64,2 +64,20 @@ var QUnit = require('steal-qunit'); | ||
QUnit.test("getWhatIChange", function() { | ||
try { | ||
observeReflections.getWhatIChange({}); | ||
QUnit.ok(false, "should throw error"); | ||
} catch(e) { | ||
QUnit.ok(true, "threw error"); | ||
} | ||
}); | ||
QUnit.test("getChangesDependencyRecord", function() { | ||
try { | ||
observeReflections.getChangesDependencyRecord({}); | ||
QUnit.ok(false, "should throw error"); | ||
} catch(e) { | ||
QUnit.ok(true, "threw error"); | ||
} | ||
}); | ||
QUnit.module('can-reflect: observe reflections: value'); | ||
@@ -128,3 +146,3 @@ | ||
QUnit.equal(arg1, "click", "eventName"); | ||
QUnit.equal(queue, "mutate", "queue") | ||
QUnit.equal(queue, "mutate", "queue"); | ||
}, | ||
@@ -131,0 +149,0 @@ removeEventListener: function(arg1, arg2, queue){ |
@@ -197,5 +197,56 @@ var canSymbol = require("can-symbol"); | ||
*/ | ||
getKeyDependencies: makeErrorIfMissing("can.getKeyDependencies","can-reflect: can not determine dependencies"), | ||
getKeyDependencies: makeErrorIfMissing("can.getKeyDependencies", "can-reflect: can not determine dependencies"), | ||
/** | ||
* @function {Object, String} can-reflect/observe.getWhatIChange getWhatIChange | ||
* @parent can-reflect/observe | ||
* @description Return the observable objects that derive their value from the | ||
* obj, passed in. | ||
* | ||
* @signature `getWhatIChange(obj, key)` | ||
* | ||
* `obj` *must* implement `@@@@can.getWhatIChange` to work with | ||
* `canReflect.getWhatIChange`. | ||
* | ||
* @param {Object} obj the object to check for what it changes | ||
* @param {String} [key] the key on the object to check | ||
* @return {Object} the observable values that derive their value from `obj` | ||
*/ | ||
getWhatIChange: makeErrorIfMissing( | ||
"can.getKeyDependencies", | ||
"can-reflect: can not determine dependencies" | ||
), | ||
/** | ||
* @function {Function} can-reflect/observe.getChangesDependencyRecord getChangesDependencyRecord | ||
* @parent can-reflect/observe | ||
* @description Return the observable objects that are mutated by the handler | ||
* passed in as argument. | ||
* | ||
* @signature `getChangesDependencyRecord(handler)` | ||
* | ||
* `handler` *must* implement `@@@@can.getChangesDependencyRecord` to work with | ||
* `canReflect.getChangesDependencyRecord`. | ||
* | ||
* ``` | ||
* var one = new SimpleObservable("one"); | ||
* var two = new SimpleObservable("two"); | ||
* | ||
* var handler = function() { | ||
* two.set("2"); | ||
* }; | ||
* | ||
* canReflect.onValue(one, handler); | ||
* canReflect.getChangesDependencyRecord(handler); // -> { valueDependencies: new Set([two]) } | ||
* ``` | ||
* | ||
* @param {Function} handler the event handler to check for what it changes | ||
* @return {Object} the observable values that are mutated by the handler | ||
*/ | ||
getChangesDependencyRecord: makeErrorIfMissing( | ||
"can.getChangesDependencyRecord", | ||
"can-reflect: can not determine dependencies" | ||
), | ||
/** | ||
* @function {Object, String} can-reflect/observe.keyHasDependencies keyHasDependencies | ||
@@ -202,0 +253,0 @@ * @parent can-reflect/observe |
147989
36
3981