Created
October 27, 2010 21:45
-
-
Save bga/650081 to your computer and use it in GitHub Desktop.
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
Object.prototype.__defineGetter__ = function(name, _fn) | |
{ | |
var self = this; | |
var _wrapper = function() | |
{ | |
return _fn.call(self); | |
}; | |
this[name] = | |
{ | |
valueOf: _wrapper, | |
toString: _wrapper, | |
jbGetter_: 1 // mark | |
}; | |
}; | |
Object.prototype.__lookupGetter__ = function(name) | |
{ | |
if(this.hasOwnProperty(name) && this[name].hasOwnProperty('jbGetter_')) | |
return this[name].valueOf; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment