Created
February 1, 2013 21:39
-
-
Save vstarck/4694338 to your computer and use it in GitHub Desktop.
__noSuchProperty__
This file contains 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
var myObject = { | |
__noSuchProperty__: function(name) { | |
return name; | |
} | |
}; | |
var myProxyObject = new Proxy(myObject, { | |
get: function(target, name) { | |
return name in target? | |
target[name]: | |
target.__noSuchProperty__(name); | |
} | |
}); | |
myProxyObject.foo; // "foo" | |
myProxyObject.foo = "bar"; | |
myProxyObject.foo; // "bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment