Skip to content

Instantly share code, notes, and snippets.

@melcor76

melcor76/main.js Secret

Last active November 19, 2019 13:11
Embed
What would you like to do?
js-tetris - proxy
let accountValues = {
score: 0,
lines: 0
}
function updateAccount(key, value) {
let element = document.getElementById(key);
if (element) {
element.textContent = value;
}
}
let account = new Proxy(accountValues, {
set: (target, key, value) => {
target[key] = value;
updateAccount(key, value);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment