PDA

View Full Version : re-useable 'components'?



cybin
12 Nov 2011, 1:06 AM
Hi!

A component I call a collection of controllers, views, stores and classes.

What I'm trying to archive is that I write a component just once and use it in several applications. I want to do that by providing symlinks to the actual files, instead of copy them over and over for each application.

Just think about providing several applications with _one_ code base, except the application specific logic and 'glue' to put things together.

For example:

Assume components for 'user' and 'group'. There is one application that only uses 'user', but another application is using 'user' and 'group'.

'user' has got a method like 'listByGroup', which 'group' shall use to provide a list of users.

My question is, how do I setup 'user' that it may work in both applications?

Thanks in advance.

mitchellsimoens
12 Nov 2011, 7:44 AM
If your different 'components' have a shared namespace, let's give it 'Core' then you could just set up a path in Loader:


Ext.Loader.setConfig({
enabled : true,
paths : {
Core : '../Core
}
});

So now all classes that start with 'Core' will resolve the path of '../Core' so 'Core.user.Base' will resolve to '../Core/user/Base.js'