Skip to content

Instantly share code, notes, and snippets.

@ivanjeremic
Created June 3, 2022 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanjeremic/477221564eb799c60e379674cf6da75b to your computer and use it in GitHub Desktop.
Save ivanjeremic/477221564eb799c60e379674cf6da75b to your computer and use it in GitHub Desktop.
const state = new Proxy(defaultState, {
set(target, value, reciver) {
switch (value) {
case "val":
document.getElementById(
"_6bb6g"
).textContent = `increment ${target.val} and ${target.val}`;
break;
case "val":
document.getElementById(
"_s75f8"
).textContent = `decrement ${target.val}`;
break;
default:
break;
}
return true;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment