-
Touch Premium Member
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
-
Best Answer Posted by
campersau1
Singletons can't be instantiated!
Just use Logger.log("Hello World!");
-
Sencha User
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
-
Forum Rules