Created
November 7, 2012 13:21
-
-
Save oberhamsi/4031545 to your computer and use it in GitHub Desktop.
js Proxy in rhino
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 = { | |
"foo": true, | |
"author": "simon", | |
"env": 123 | |
} | |
var myProxy = new JavaAdapter(org.mozilla.javascript.NativeObject, { | |
// The "start" argument is here for setters and getters living | |
// on a prototype, so they know what to use as "this"-object. | |
put: function(name, start, value) { | |
myObject[name] = value; | |
}, | |
get: function(name, start) { | |
return myObject[name]; | |
} | |
}); | |
print(myProxy.author) |
ah, thanks! updated.
print(myProxy.xyzzy) => undefined
However, typeof myProxy.xyzzy is "string"
Seems like a bug to me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The "start" argument is here for setters and getters living on a prototype, so they know what to use as "this"-object.