Add old value as third parameter to listener callbacks
This commit is contained in:
parent
fd58f3b437
commit
b28dd09709
1 changed files with 2 additions and 2 deletions
|
@ -24,8 +24,8 @@ export default (target={}) => {
|
||||||
let proxy = new Proxy(target, {
|
let proxy = new Proxy(target, {
|
||||||
set: (target, prop, value) => {
|
set: (target, prop, value) => {
|
||||||
console.log(callbacks)
|
console.log(callbacks)
|
||||||
if (callbacks.has("*")) callbacks.get("*").forEach(callback => callback(value, prop))
|
if (callbacks.has("*")) callbacks.get("*").forEach(callback => callback(value, prop, target[prop]))
|
||||||
if (callbacks.has(prop)) callbacks.get(prop).forEach(callback => callback(value, prop))
|
if (callbacks.has(prop)) callbacks.get(prop).forEach(callback => callback(value, prop, target[prop]))
|
||||||
return Reflect.set(target, prop, value)
|
return Reflect.set(target, prop, value)
|
||||||
},
|
},
|
||||||
get: (target, prop, value) => {
|
get: (target, prop, value) => {
|
||||||
|
|
Loading…
Reference in a new issue