logWhatChangesMe
Log what affects an observable.
canDebug.logWhatChangesMe(observable, [key])
Logs what affects the observable. If a key
is provided, logs what affects the
key
of the observable.
The following example uses DefineMap
to create a Person
type with a fullName
property that derives its value from first
and last
. Then it calls logWhatChangesMe
to log what affects the fullName
property of the me
Person instance:
import debug from "can-debug";
const canDebug = debug();
const Person = DefineMap.extend( "Person", {
first: "string",
last: "string",
fullName: {
get() {
return `${this.first} ${this.last}`;
}
}
} );
const me = new Person( { first: "John", last: "Doe" } );
canDebug.logWhatChangesMe( me, "fullName" );
Calling logWhatChangesMe
prints out the following message to the browser's
console:
Parameters
- observable
{Object}
:An observable.
- key
{Any}
:The key of a property on a map-like observable.