This repository was archived by the owner on Mar 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 214
Show Pristine and Touch #122
Copy link
Copy link
Open
Description
Is it possible to add additional bool values to include pristine and touch representations?
And example would be this:
var ex = {};
watch(ex,function(prop,action,newvalue,oldvalue,status){
console.log(status);
});
//add new prop
ex.prop = 10;
/*
ex.prop.status:
Pristine: true;
Touched: false;
*/
//change the value
ex.prop = 12;
/*
console would show:
status:
Pristine: false;
Touched: true;
*/
//change value back to original value
ex.prop = 10;
/*
console would show:
status:
Pristine: true;
Touched: true;
*/
This would be very handy for change tracking. You're already tracking previous and new values - It would be the same to store an additional value that can't change on the creation of the property to check against pristine. And then setting touched would be simple as the first time the watcher set is fired, it would be turned to true.
Let me know if this is something you would consider and how long you would expect to implement ( assuming you would consider it )
Otherwise, I will just code it for myself.
Metadata
Metadata
Assignees
Labels
No labels