Loading ...
Sorry, an error occurred while loading the content.

General design question constructing a singleton class

Expand Messages
  • young_matthewd
    (preface this e-mail with a general statement: my javascript knowledge is extremely low) Using YUI Ext .33 to build up an application interface along with the
    Message 1 of 2 , Nov 1, 2006
    • 0 Attachment
      (preface this e-mail with a general statement: my javascript
      knowledge is extremely low)

      Using YUI Ext .33 to build up an application interface along with
      the Yahoo 11.4 libraries.

      Looking at the example (number 6 on Jack's article "cross browser
      web-20 layouts part 2 ajax-feed-viewer-20") he has declared the
      Example function (? is there a name for this type declaration ?) in
      a way which i assume is meant to be used as a singleton object.
      Namely, that only one instance of Example should be defined. Is
      that what happens with the return statement immediately pushing all
      functions (like init) and the internal variables are private? Or?

      Why not just define Example like YAHOO.ext.EventManager which is set
      to a new function?

      Realise my questions are disjointed and unclear but it is extremely
      difficult from a Java/C++ world to understand Javasript design
      patterns. Any links/help matieral online with design patterns?
    • young_matthewd
      Think I got my answers by reading the following article: http://www.digital-web.com/articles/objectifying_javascript/ And I think a layout constructor for my
      Message 2 of 2 , Nov 1, 2006
      • 0 Attachment
        Think I got my answers by reading the following article:
        http://www.digital-web.com/articles/objectifying_javascript/

        And I think a layout constructor for my uses ought to be built up just
        like the YAHOO.ext.EventManager (singelton by calling new on an
        anonymous function) and if i want private variables then the
        constructor way be returned.
      Your message has been successfully submitted and would be delivered to recipients shortly.