LesJ
6 Feb 2012, 8:58 AM
I thought I had a pretty good understanding how singletons are implemented in Ext... but the drawing package has some advanced uses...
.. take a look at the Ext.draw.engine.SvgExporter singleton... you will seen that all code is static, yet this is a singleton... and here's how it's used:
var svgString = Ext.draw.engine.SvgExporter.self.generate({}, surface);
Why this design? Why SvgExporter is a singleton since all code is class code?
I find the self usage very interesting...
.. take a look at the Ext.draw.engine.SvgExporter singleton... you will seen that all code is static, yet this is a singleton... and here's how it's used:
var svgString = Ext.draw.engine.SvgExporter.self.generate({}, surface);
Why this design? Why SvgExporter is a singleton since all code is class code?
I find the self usage very interesting...