Code Monkey home page Code Monkey logo

Comments (2)

johnyanarella avatar johnyanarella commented on July 20, 2024

Because you've used the singleton: true configuration when defining your class, the Sencha class system automatically creates a single instance of the class you defined in that file, and sets MyApp.preferences.Preferences with a static reference for that instance (rather than an instantiatable class definition). Consequently, Deft JS's internal attempt to eagerly create an instance of the specified class, i.e.Ext.create('MyApp.preferences.Preferences'), fails with that error.

If you remove that line, Deft JS will be able to eagerly create an instance of the MyApp.preferences.Preferences class and will fulfill any injection requests with a singleton instance managed by the IoC container.

You're not the first person to run into this - so I'm considering adding logic to detect classes that are explicitly defined to be singletons via the Sencha class system. Provided we can obtain a reference to the underlying class instance, we can sidestep this confusion and populate the IoC container with that same reference. In the case where a class has been defined as a singleton and the IoC container is asked to configure it as a prototype, we will still need to throw an error. However, it will be Deft JS throwing the error, rather than the Sencha class system (which threw the error you reported). We'll want to make that error explicitly guide the developer as to how to fix the problem.

from deftjs.

ilann avatar ilann commented on July 20, 2024

Problem solved. Thank You. Great work!

from deftjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.