ValueOptions
Object
Options
-
resolve
{function(value)}:Sets the value of this property as
value. During a batch, the last value passed toresolvewill be used as the value. -
listenTo
{function(bindTarget, event, handler, queue)}:A function that sets up a binding that will be automatically torn-down when the
valueproperty is unbound. ThislistenTomethod is very similar to the listenTo method available on DefineMap. It differs only that it:- defaults bindings within the notifyQueue.
- calls handlers with
thisas the instance.
Examples:
// Binds to the map's `name` event: listenTo( "name", handler ); // Binds to the todos `length` event: listenTo( todos, "length", handler ); // Binds to the `todos` `length` event in the mutate queue: listenTo( todos, "length", handler, "mutate" ); // Binds to an `onValue` emitter: listenTo( observable, handler ); // -
lastSet
{can-simple-observable}:An observable value that gets set when this property is set. You can read its value or listen to when its value changes to derive the property value. The following makes
propertybehave like a normal object property that can be get or set:{ property: { value: function( prop ) { // Make sure the initial value is whatever was set. resolve( prop.lastSet.get() ); // When the property is set, update the read value. listenTo( prop.lastSet, resolve ); } } }