Major changes to MVC in ExtJS4.2?
Asked Answered
R

2

7

I recently heard that there are some major changes coming up with 4.2 concerning the way a MVC application work. I downloaded the beta but the API seems all in all the same. Can anyone explain me the upcoming changes and what thats all about? Do I need to fear that all my controllers will stop working if I update?

Rigatoni answered 22/12, 2012 at 8:42 Comment(0)
U
6

No, you don't have to fear unless you are doing totally weird things.

Well the main changes are that controllers no longer require a Ext.app.Application instance to the. That is due to a change of the Ext.app.EventBus which is now sort of singleton and therefore enables all controllers to use the same instance.

That is what I know for now. I may update my post if I get new information

Unilingual answered 22/12, 2012 at 8:51 Comment(0)
X
8

Yes, I would call the changes we've made to MVC in 4.2 pretty major; however backwards compatibility has always been our priority. I do acknowledge that prior to 4.2 there were many long unsolved problems with MVC implementation and that prompted people to jump through all kinds of hoops to do what they needed. We've been trying to resolve these and streamline MVC experience, along with adding several features aimed at devs who have big apps on their hands. 4.2 beta 2 will include most of these, and we'd love to hear your feedback on them.

I plan to write up on these improvements before 4.2 is released, but here's a quick list:

  • Ext.app.EventBus, like @sra mentioned, is now a singleton, and is always available in your application - although it doesn't make much sense to use it directly
  • Ext.app.Controller no longer depends on Ext.app.Application to do things, and can be instantiated without bringing up the whole dependency tree - which means you can unit test your Controllers!
  • It is now possible to create your own Application class(es) extending from Ext.app.Application, and include your logic in this class
  • Ext.application() no longer does unspeakable black magic; when passed your Application class name it just instantiates it. If you pass it a config object like before, it will declare new Application class with these config options, and instantiate it - same logic as above, a bit different execution
  • As the result of two items above, Ext.application() no longer requires all your dependency tree synchronously (it used to), so that's one thing to watch for
  • It is now possible to explicitly declare all namespaces (project parts) in your Application class, to avoid any kind of ambiguities when resolving dependencies
  • Ext.app.Application now deals properly with its own ancestry and can be used as a top level Controller in your application
  • A new concept of event domains was introduced; it is now possible to fire and listen to events not related to Components. We provide several domains out of the box, and it's easy to add your own - something like I described in my article some time ago, but cleaner and more powerful

There were some more little improvements and hacks for backwards compatibility, mostly concerned with dependency tracking. These should not trip you if you don't do something overly crazy. If you do, that's what Betas are for. :)

Hope this helps!

Xenia answered 8/1, 2013 at 22:46 Comment(0)
U
6

No, you don't have to fear unless you are doing totally weird things.

Well the main changes are that controllers no longer require a Ext.app.Application instance to the. That is due to a change of the Ext.app.EventBus which is now sort of singleton and therefore enables all controllers to use the same instance.

That is what I know for now. I may update my post if I get new information

Unilingual answered 22/12, 2012 at 8:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.