Created
June 21, 2011 07:54
-
-
Save fflorent/1037428 to your computer and use it in GitHub Desktop.
overrides ORYX.Editor constructor for accessing to unique instance (Singleton-like)
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
// overrides ORYX.Editor constructor for accessing to unique instance (Singleton-like) | |
(function(OE){ | |
var proxy = OE.prototype.construct; | |
OE.getInstance = function(){ | |
return OE.instance; | |
}; | |
OE.prototype.construct= function(){ | |
proxy.apply(this, arguments); | |
OE.instance = this; | |
}; | |
})(ORYX.Editor); | |
// now, after ORYX.Editor constructor has been called, | |
// you can access to unique ORYX.Editor instance by this way : | |
// var myEditor = ORYX.Editor.getInstance(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment