Created
August 7, 2018 20:50
-
-
Save robertsheacole/be77afe04c03499e02f84adbc37b4984 to your computer and use it in GitHub Desktop.
A very simple function that syncs up two objects without a bulky framework.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reactive(origin, destination) { | |
return new Proxy(origin, { | |
set(target, key, value) { | |
Reflect.set(target, key, value); | |
destination[key] = value | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment