on
Listen to changes in the observable's value.
.on( handler[, queue='mutate'] )
This adds an event handler in the observable's handlers tree. If this is the first handler, the observable's onBound method is called.
observable.on(function(newVal){ ... });
observable.on(function(newVal){ ... }, "notify");
Parameters
- handler
{function(newValue, oldValue)}
:A handler that will be called with the new value of the observable and optionally the old value of the observable.
- queue
{String}
:The can-queues queue this event handler should be bound to. By default the handler will be called within the
mutate
queue.