Skip to content

Key Changes in Deft JS 5

Brian Kotek edited this page Aug 29, 2014 · 18 revisions

Back to Wiki Home

When upgrading an existing application to Ext JS 5 and Deft JS 5, many things will carry over with minimal changes:

  • You will still use Deft.Injector.configure() to configure the IoC container, using the same syntax to define dependency providers, value mappings and factory functions.
  • The inject annotation is still used to inject dependencies.
  • Observing events fired from injected objects is still possible using the observe annotation.
  • The Promise API is still present and stable.

The majority of changes will occur in view controllers. Sencha has implemented their own view controllers, and these work somewhat differently than the Deft JS 0.9 view controllers.

The most significant change relates to how view controllers interact with views. The Sencha control configuration is a bit more limited than what Deft provided in the past:

  • Selectors are not automatically set up using the id or itemId of the target view component.
  • Getters and setters for view component references are not created from the control config. Sencha uses a separate refs config for this.
  • Sencha is advocating that developers forego the use of control:, and instead define event handler names on the view components themselves. The handler functions are located using the new referenceHolder features. These will typically be functions defined on a view controller. On the plus side, it means we’ll have to deal with component query selectors much less frequently.
  • Sencha also is advocating that developers forego the use of refs, and instead use lookupReference() in a view controller to obtain references to view components.

As you can see, it doesn't really make sense for us to push forward with our control: implementation. We recommend that existing Deft JS developers go ahead and adopt the new approach, using references and view-defined listener names.

The other major change is mainly an internal one: mixins are now used instead of class preprocessors. For developers, this means that classes will need to apply the Deft.Injectable mixin when using the inject annotation. This is being done to better support projects built with Sencha Cmd, because as of now Cmd doesn’t recognize custom preprocessors in its define-rewrite optimizer.

Next: Adding Deft JS to Your Application