[dojo-contributors] common cometd.js for dojo & jquery

Greg Wilkins gregw at mortbay.com
Tue May 5 00:34:43 EDT 2009


James Burke wrote:

> I have not used the cometd modules directly, so I may be missing
> something above. How I read the above: you have a new streamlined JS
> module at org/cometd.js, and perhaps it obsoletes the dojox.cometd
> stuff, or the dojox.cometd. stuff are just adapters on top of the
> org/cometd.js module.

this is correct.

it is intended to replace the implementation that is currently
checked into dojox.


> You are wondering how org/cometd.js can be loaded in Dojo without an
> explicit script tag. For that case I normally suggest doing the
> following:
> 
> 1) In org/cometd.js, have a block near the top of the file with something like:
> if(typeof dojo != "undefined"){
>     dojo.provide("org.cometd");
> }

while that would work, it's not that extensible.
We might end up with similar code for jquery, prototype,
ext.js etc. etc.


> 2) For users of dojox.cometd, instruct them where to download the
> org/cometd module and to either place the org directory as a sibling
> to dojox or configure the path to org/cometd.js via
> djConfig.modulePaths = { "org.cometd", "path/to/org/cometd" }.
> dojo.setModulePath() could also be used instead of
> djConfig.modulePaths (but after dojo is loaded). Notice for the path
> to the cometd.js file, in modulePaths, I left off the ".js" part of
> the name. The module mapping in Dojo allows you to specify a
> modulePath for a directory, or in this case, a specific module, but
> just leave off the .js extension for a specific module.

Well here is the other problem... currently cometd-dojox is
checked into dojox as part of the whole dojo tree and it is
released with dojo.

Perhaps it would be better to split this out of dojox
so that to code resided and was released from org.cometd

this would mean that it would be excluded from the dojo
build system and could not be wrapped up into a custom
built js.

This is more than a technical question.   It is really
about if dojox modules will ever have lifecycles of their
own.


> I suggest not using dojo._loadPath directly or the variation of
> dojo.require that passes true for omitModuleCheck. It makes it hard
> for the dojo.addOnLoad() callbacks to work reliably if we do not check
> for the the module being loaded. 

hmmm good point

> The typeof dojo check above in the
> cometd.js should avoid the need for omitModuleCheck, and still allow
> the file to work without dojo being loaded.

hmmm still ugly.

any other options???








More information about the dojo-contributors mailing list