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.

Complete path of changed object #77

Open

Description

@qualityking

Currently if i am changing something at level2 or level3 it just show me property name which got changed, but not full path

var root= {
  level1 : {
    something : 'at level 1',
    level2: { something : 'at level2', 
        level3: {
                something : 'something at level3'
            }
        }
  }
}


watch(root,  function(prop, action, newvalue, oldvalue){
        alert(prop+" - action: "+action+" - new: "+newvalue+", old: "+oldvalue+"... and the context: "+JSON.stringify(this));
    });


root.level1.level2.level3.something = 'updated at level3'

Any possibility that i will get "root.level1.level2.level3.something" rather than just "something" because property "something" is available at all levels.

Well i just want to thank you for this great efforts!!!

  • Manish Bansal

Activity

  1. grofit commented on Feb 18, 2016

    @grofit

    👍 This is something I need at the moment, @qualityking did you find a way around this in the end?

  2. grofit commented on Feb 26, 2016

    @grofit

    I have tried to implement this myself but it seems a bit chaotic and I cannot for the life of me get the path to append, so I can get the end property no problem but keeping the whole route to that object in scope seems a nightmare. @melanke is there any chance you could offer some guidance as to where this sort of change would need to happen, as adding a final arg propertyPath and appending to it every time it goes to a nested object does not seem to persist when it gets to the final object, but it could just be me missing a step.

  3. utillity commented on Aug 27, 2017

    @utillity

    I'd need this, too!

  4. grofit commented on Aug 27, 2017

    @grofit

    I dont think this is getting added any time soon, I ended up creating my own primitive watcher library specifically for the validation lib I was using watcher for, incase it is of help to anyone else source is here:

    https://github.com/grofit/treacherous/blob/master/src/watcher/model-watcher.ts

  5. adelriosantiago commented on Sep 22, 2017

    @adelriosantiago

    +1 I need this too! @melanke this would be a good feature. Any idea how to implement it?

  6. grofit commented on Sep 22, 2017

    @grofit

    One tricky bit is also workout out how to spit out array routes, like I ended up needing stuff like:

    someObject.someProperty.withAnArray[2].name;
    

    Indicating name had changed in that path.

  7. melanke commented on Mar 15, 2018

    @melanke
    Owner

    This is really useful, I will try to implement

  8. softmantk commented on Dec 10, 2018

    @softmantk

    Is there any update of this enhancement ? @melanke

  9. melanke commented on Dec 10, 2018

    @melanke
    Owner

    No, I didn't even tried, I forgot about it, maybe I will try to fix, but no rush... I will accept pull requests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions