-
22 Apr 2012 3:50 PM #1
How do you add requires section in Architect 2
How do you add requires section in Architect 2
I can't seem to find a way to add the requires section to my app from Architect 2.
Any pointer highly appreciated.
thanks
-
23 Apr 2012 9:25 PM #2
If you need to dynamically load additional classes, you can add a loader config to the application node and then configure the require on the Loader.
Aaron Conran
@aconran
Sencha Architect Development Team
-
24 Apr 2012 7:58 AM #3
The loader doesn't have any require option. Could you be more clear on how to add the require to the loader? Looking at the docs, the require is a method of Loader not a Property, and Sencha Architect doesn't let you add method calls to the loader config. Does it have to be done inside a function on the application?
-
26 Apr 2012 6:31 AM #4
Any answer/success with this? I need to add a requires section as well and I'm not seeing a clear path.
Aaron, your explanation includes terminology that does not appear to be available via Architect.
Thanks
JB
-
26 Apr 2012 11:41 AM #5
Oh help.
My understanding of "requires" is that it is only used during development, that the process of deployment (jsb3) resolves all the "requires". Sorta like compiling. You deploy the finished app.js --and it won't be loading anything dynamically, it will already have the required classes packaged in.
The api just says "List of classes that have to be loaded before instantiating this class." Which defines the word (requires=has to be loaded first) but doesn't elaborate. The "getting started" guide and miscellaneous forum posts led me to the conclusion above.
It simply makes sense to me, so I have been doing it. If nothing else, it helps documents the class.
I set my loader paths dynamically. I don't have a static html page for my app, I am using a php cms system with those insane seo friendy urls to nowhere. I got tired of extjs thinking it has a different webroot, so I used window.location to get the url, then backed up until I hit the root, then prepended the appropriate number of "../" to all loader config paths.
I supply an additional js file before the app. That has my loader config. And that is where I have been stuffing any requires.
Now maybe SA is going to step in with an alternate deployment chain so "requires" won't be necessary?
My own answer doesn't make sense to me. A large app needs to load controllers dynamically, and those controllers are going to have a ton of dependencies.
If only I knew what it is I don't know, I could make some decisions and move forward !
But I don't know how to translate what I have into SA unless I just drop all the requires.
-
26 Apr 2012 2:32 PM #6
I'm currently testing an applicartion with dynamic class loading instead of having large monolitic app-all.js.
Of course what I deploy to app server is compressed (with yuicompressor) js files.
Regards.UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!
-
27 Apr 2012 6:54 AM #7
The ability to add custom requires to the application is coming soon!
Phil Strong
@philstrong
#SenchaArchitect
Sencha Architect Development Team
SenchaCon or bust!
Known Bugs in Architect Latest
-
30 Apr 2012 5:35 PM #8
Umm, how then should one handle application 'globals' (e.g. base URL's for stores, etc) in Architect if we can't create a ..Config class and require it?
-
6 May 2012 5:27 AM #9
You can use the "launch" function to define globals. This is how I do:
Code:launch: function() { Admin.global = { HOME_CARD: 0, TOURS_CARD: 1, HOTELS_CARD: 2, ... }; }
-
7 May 2012 3:14 AM #10
In SourceDevCon in London I think Aaron or some of the other speakers added to the requires list of the application as part of his Sencha Architect talk, however I can't really find that option in the public 412 build.
Specifically I want to require the device.* as shown on the screen.Sven Tore Iversen


Reply With Quote