BScriptResource.dependsOn()

View: New views
1 Messages — Rating Filter:   Alert me  

BScriptResource.dependsOn()

by Franck Routier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I have added the possibility to create dependencies in BScriptResource
using a dependsOn(...) method.

Example usage is:

BScriptResource myFavoriteJsLib = new BSrciptResource("pathTolib");

BScriptResource myFirstPlugin = new
BScriptResource("pathToplugin1").dependsOn(myFavoriteJSlib);

BScriptResource mySecondPlugin = new
BScriptResource("pathToplugin2").dependsOn(myFavoriteJSlib);

BScript myScript1 = new BSript("do the
stuff").addResource(myFirstPlugin);

BScript myScript2 = new BSript("do other
stuff").addResource(mySecondPlugin);


When used in a page, all this will render as:

<head>
<script src="pathTolib" />
<script src="pathToplugin1" />
<script src="pathToplugin2" />
...

PathToLib is only added once. It is added before the depending js code
is added. Also if a third plugin were to depend on first plugin, it will
make sure pathToplugin1 is added before it.

I hope this is not too nebulous :).

The downside is I changed the signature for BScriptResource.getSource().
It now returns a List<String>, and not a String. I assumed it is mainly
used internaly by BScriptResourceRenderer, so it should not have any
impact on existing code...

Franck




--
Barracuda mailing list
Barracuda@...
http://www.ow2.org/wws/lists/projects/barracuda
LightInTheBox - Buy quality products at wholesale price