Package Exports
- can-reflect
- can-reflect/can-reflect-test
- can-reflect/reflections/call/call
- can-reflect/reflections/get-set/get-set
- can-reflect/reflections/observe/observe
- can-reflect/reflections/shape/shape
- can-reflect/reflections/type/type
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (can-reflect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
can-reflect
Reflect allows you to reflection on unknown data types.
By looking for symbols in [can-symbol], can-reflect lets someone act upon
any data type without having to have prior knowledge of it.
var Thing = function(){
};
Thing.prototype.method = function(){}
var canReflect = require("can-reflect");
canReflect.isConstructorLike(Thing) //-> trueThe different reflections you can use are grouped by reflection type as follows:
- Type Reflections - Tell you what the value is.
.isConstructorLike.isFunctionLike.isIteratorLike.isListLike.isMapLike.isMoreListThanMapLike(lists can often still be maps).isObservableLike.isValueLike.isSymbolLike
- Shape Reflections - Give you information about the value.
- own and enumerable
.eachIndex.eachKey.each.getOwnEnumerableKeys(aka.keys).toArray
- own
.getOwnKeys.getOwnKeyDescriptor
- all (pending)
- own and enumerable
- Getter / Setter Reflections - get or set some value on another value.
.getKeyValue,.setKeyValue,.deleteKeyValue- for maps (get,set, anddeleteare aliases).getValue,.setValue- for things like computes.splice,.addKeys(keyValues[,index]),.removeKeys(keysOrValues[,index])(PENDING?)
- Function Reflections - call functions or create instances
.call.apply.new
- Observe Reflections - listen to when things change
.onKeyValue,.offKeyValue.onKeys- when anything changes.onKeysAdded,.onKeysRemoved.getKeyDependencies- for debugging.keyHasDependencies.onValue,.offValue.getValueDependencies.valueHasDependencies.onEvent,.offEvent- listen to an event on something
TODO:
.deleteKeyValue,.getand.setaliasesaddKeys/removeKeysisInitializing
