Results 1 to 2 of 2

Thread: Question about Singletons in 4.0

  1. #1
    Touch Premium Member
    Join Date
    May 2009
    Posts
    7

    Default Answered: Question about Singletons in 4.0

    I've become accustomed to using Ext.define/Ext.create to manage and use my custom classes. I'm a little bit confused about using the singleton configuration. I see this in the docs:


    Ext.define('Logger',{ singleton:true, log:function(msg){ console.log(msg);}});Logger.log('Hello');If I do something like:


    Ext.define('IH.core.Logger',{ singleton:true, log:function(msg){ console.log(msg);}});and then call this like so from say a controller:var log = Ext.create('IH.core.Logger');
    I get the dreaded "c is not a constructor" error.

    Any pointers would be appreciated.

    Thanks and regards,

    Robert Moskal
    Brooklyn USA

  2. Singletons can't be instantiated!

    Just use Logger.log("Hello World!");

  3. #2
    Sencha User
    Join Date
    Jun 2009
    Posts
    102
    Answers
    8

    Default

    Singletons can't be instantiated!

    Just use Logger.log("Hello World!");

Posting Permissions

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