From b28dd09709f0fea2eabc8043692d41452fbf0113 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Tue, 19 Oct 2021 18:08:22 +0200 Subject: [PATCH] Add old value as third parameter to listener callbacks --- listener.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/listener.js b/listener.js index cd3b5d3..495b317 100644 --- a/listener.js +++ b/listener.js @@ -24,8 +24,8 @@ export default (target={}) => { let proxy = new Proxy(target, { set: (target, prop, value) => { console.log(callbacks) - if (callbacks.has("*")) callbacks.get("*").forEach(callback => callback(value, prop)) - if (callbacks.has(prop)) callbacks.get(prop).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, target[prop])) return Reflect.set(target, prop, value) }, get: (target, prop, value) => {