You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by adamh <ad...@azudio.co.uk> on 2008/01/12 18:10:32 UTC

JS Library Inclusion Idea

Hi All,

I love T5.

However I'm not over the moon with being force-fed protoype/scriptaculous
when I'm developing say a dojo app, I don't want proto/scrpt downloaded as
well to do stuff that dojo can do, so here is my suggestion with dealing
with this.

Normally all the standard functionality is handled through the tapestry.js
file which is coded to use proto/script, now surely all we need to do is
have a standard API defined which can handle all the Tapestry stuff like
validation etc and have an implementation for each js library?

So we have a Tapestry javascript API defined interface like:
	Tapestry.registerForm(form, clientValidations)
	Tapestry.registerValidations : function(form, clientValidations)
	Tapestry.linkZone(link, zoneDiv)
	Tapestry.initializeZones(zoneSpecs, linkSpecs)
	Tapestry.addValidator(field, acceptBlank, validator)
	Tapestry.ElementAdditions.decorateForValidationError(element, event,
message)
	Tapestry.Validator.required(field, message)
	Tapestry.Validator.minlength(field, message, length)
	Tapestry.Validator.maxlength(field, message, maxlength)
	Tapestry.Validator.min(field, message, minValue)
	Tapestry.Validator.max(field, message, maxValue)
	Tapestry.Validator.regexp(field, message, pattern)
	etc

tapestry.js could just contain common lib agnostic stuff only - no
implementations of the above interface. 

Then create a tapestry-[lib].js file for each library.

Then tell the app what libraries to use along with a Tapestry implementation
to use:

js-libraries=tapestry-tapestry.js
js-libraries=/dojo-1.0.2/dojo/dojo.js,tapestry-dojo102.js
js-libraries=/prototype-1.6/prototype.js,/scriptaculous/scriptaculous.js,tapestry-proto16scriptac18.js
js-libraries=/ext-2.0/extjs.js,tapestry-ext20.js

The last entry will be the Tapestry implementation for that library.

So you would end up with the following getting downloaded: tapestry.js,
[lib].js, tapestry-[lib].js

That way Tapestry becomes completely library agnostic, it just makes calls
to its API and the actual implementation is handles by the specialised
tapestry-[lib].js. 

I'd love to see something like this implemented, I don't think there should
be any major technical reasons why something like this could not be
implemented (or can it de done now??) but I'd like to know what people
think.

Regards,
Adam

Reated:https://issues.apache.org/jira/browse/TAPESTRY-1650

PS. Keep up the great work lads.
-- 
View this message in context: http://www.nabble.com/JS-Library-Inclusion-Idea-tp14776058p14776058.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org