Results 1 to 4 of 4

Thread: Singleton class and where to put it

  1. #1
    Sencha Premium User
    Join Date
    May 2012
    Posts
    12
    Vote Rating
    1
      0  

    Default Singleton class and where to put it

    Hi,

    I have created a singleton class using ExtJS 6.5.2 on a universal app. This particular class is to handle http errors, but I have the same issue with other common libraries I want to put in singleton classes.

    I tried to put it under a app\utils folder with the name Ext.define('Project.utils.HttpErrorHandler', { singleton: true, .. etc ...});

    I am not sure were to define it properly because the app thinks is a model and expects it in app/model. I know this because the browser console says it can't find http://...../app/model/HttpErrorHandler.js

    I am not sure what I am missing here

    Thanks

  2. #2
    Sencha User
    Join Date
    Apr 2013
    Posts
    891
    Vote Rating
    180
      1  

    Default

    Did you require the class correctly?

  3. #3
    Sencha Premium User
    Join Date
    May 2012
    Posts
    12
    Vote Rating
    1
      1  

    Default

    Ok I tried this following I think what you suggest

    I change

    requires: [
    'Project.*'
    ]

    TO BE

    requies: [
    'Project.utils.HttpErrorHandler'
    ]

    Now it expects the right "utils" folder BUT is expecting it in the modern profile.

    I have a universal app, and I defined that class in the shared part, that is in "app\utils"

    One thing I noticed is that at the moment only the modern profile compiles, therefore I am doing: sencha build modern

    Could this be part of the problem?

  4. #4
    Sencha Premium User
    Join Date
    May 2012
    Posts
    12
    Vote Rating
    1
      0  

    Default

    Yes, that was the problem

    Thanks!

Similar Threads

  1. Performance of Singleton class
    By niteshjainttl in forum Ext 6: Q&A
    Replies: 3
    Last Post: 7 Sep 2016, 3:42 AM
  2. Inheriting Singleton class
    By msuresh in forum Ext: Discussion
    Replies: 2
    Last Post: 13 Aug 2012, 7:18 AM
  3. scope of a singleton class vs static class
    By himanshu.joshi in forum Ext: Discussion
    Replies: 3
    Last Post: 6 Jul 2012, 11:39 PM
  4. Replies: 2
    Last Post: 12 Jan 2012, 12:26 PM

Posting Permissions

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