Skip to content

Instantly share code, notes, and snippets.

@fflorent
Created June 21, 2011 07:54
Show Gist options
  • Save fflorent/1037428 to your computer and use it in GitHub Desktop.
Save fflorent/1037428 to your computer and use it in GitHub Desktop.
overrides ORYX.Editor constructor for accessing to unique instance (Singleton-like)
// 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