can-event-queue/value/value
Mixin methods and symbols to make this object or prototype object behave like a single-value observable.
mixinValueBindings( obj )
Adds symbols and methods that make obj
or instances having obj
on their prototype
behave like single-value observables.
When mixinValueBindings
is called on an obj
like:
var mixinValueBindings = require("can-event-queue/value/value");
var observable = mixinValueBindings({});
observable.on(function(newVal, oldVal){
console.log(newVal);
});
observable[canSymbol.for("can.dispatch")](2,1);
// Logs: 2
mixinValueBindings
adds the following properties and symbols to the object:
When the object is bound to for the first time with .on
or @can.onValue
, it will look for an onBound
function on the object and call it.
When the object is has no more handlers, it will look for an onUnbound function on the object and call it.