Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

Show Pristine and Touch #122

Description

@shiftlessatol

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions