View Full Version : Requires for ExtJS classes?
30 Sep 2012, 8:42 AM
If we plan to use Sencha Cmd, should we have requires statements for internal ExtJS classes or will Cmd figure it out? For example, if I have a view that displays a button, do I need to manually require Ext.button.Button for the minimization to work correctly?
30 Sep 2012, 12:20 PM
Afaik, it's not sophisticated enough yet to detect what classes are being used without being told. The fact that the new version of Sencha Cmd is doing code analysis is pretty cool, and I can imagine that it's technically feasible for the analyzer look for Ext.create, xtype, etc., and determine the list of classes that way. I can also imagine there would be a lot of scenarios to cover.
I'd be very interested to know whether something like this is in the roadmap. It's definitely a nuissance to have to require individual classes from other classes, and it's also very error-prone. Obviously, requiring whole namespaces, especially in a central place like app.js, gets around this, but is wasteful.
30 Sep 2012, 3:45 PM
In 18.104.22.168 we fixed SDKTOOLS-157 (Sencha Cmd does not auto-detect xtype/xclass dependencies) which is code-speak for detecting dependencies of these forms:
Calls to Ext.create
Calls to Ext.widget
Use of 'xtype' property in object literals
Use of 'xclass' property in object literals (full classname supported by Ext.create).
Use of class name with operator new (as in, "new Ext.panel.Grid")
Use of static class members (as in, "Ext.foo.Bar.someStatic")
For now these dependencies are injected as "requires". We hope to improve that (to avoid injecting circular requires) and offer the ability to switch between full auto-dependency mode or strict-requires-only mode where these dependencies are reported as warnings/errors.
This should mean that if you are using "ext-all*.js" as your bootstrap, you won't need to religiously use "requires" and "uses" for Ext classes ... unless you want that level of control.
For your own classes, since these are not built in to the bootstrap file, you will need to use these to run without compilation (typical "dev mode").
Clear as mud? :)
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.