Skip to content

Instantly share code, notes, and snippets.

@iiison
Created July 31, 2021 03:27
Show Gist options
  • Save iiison/e14941c242645dd4f6e7c2e8aa8340f0 to your computer and use it in GitHub Desktop.
Save iiison/e14941c242645dd4f6e7c2e8aa8340f0 to your computer and use it in GitHub Desktop.

Revisions

  1. iiison created this gist Jul 31, 2021.
    17 changes: 17 additions & 0 deletions watch.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    var obj = {
    a : 'value',
    b : 'another value'
    }

    var objProxy = new Proxy(obj, {
    set(target, key, value) {
    console.log({ key, value })
    if (key === 'b') {
    debugger
    }
    }
    })

    obj = objProxy
    obj.a = 'test' // logs `a` as key and `test` as value