Results 1 to 3 of 3

Thread: Ext.draw - SvgExporter question

  1. #1
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,932
    Vote Rating
    548
      0  

    Default Ext.draw - SvgExporter question

    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:

    Code:
    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...

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    Not the way I would have done it.... put it in the statics and within a closure, just seems unneeded to me but I'm not the author so maybe this convention was forced.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,932
    Vote Rating
    548
      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    Not the way I would have done it.... put it in the statics and within a closure, just seems unneeded to me but I'm not the author so maybe this convention was forced.
    The singleton part is interesting... w/o the singleton there would be no need to refer to self, which makes me wonder why singleton was used... This is probably the most interesting Ext code I have seen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •