[dojo-contributors] common cometd.js for dojo & jquery
gregw at mortbay.com
Mon May 4 01:27:06 EDT 2009
Simone has done some great work on the jquery implementation of cometd, which
free from the ravages of evolution and changing ideas is a much cleaner implementation
of the bayeux protocol that what is in dojox/cometd/*
So Simone has done the work to abstract out a common js cometd.js for use
by both dojo and jquery implementations (and eventually prototype, ext.js etc.)
This work is checked into
and is roughly working for dojo already.
However, other than some small API differences, there is a big packaging
difference. If you look at:
you see that is a dojo module that does a provide("dojox.cometd._base")
but makes the assumption that cometd.js has previously been loaded,
so you need to do
the cometd.js creates a org.cometd object which is extended
by dojox/cometd/_base.js before doing a
dojox.cometd = new org.cometd.Cometd();
Previously to use cometd in dojo, you would do something like:
Note that you can require a specific transport type and specific
extensions. With the common js approach, all transport types
are loaded (pretty small) and it is yet to be determined if
extensions will be in a separate file or not.
What I'd like to be able to achieve is to avoid the need
to separately source the cometd.js
Looking at the source of loader.js, it appears that I should
be able to pass true to omitModuleCheck and thus in _base.js do
and that will load org/cometd/base.js and ignore that fact
that it does not have a provides clause. This would
work just as well for extensions etc.
So some questions (dumb and/or otherwise):
Is this what omitModuleCheck is for?
or should we just use dojo._loadPath directly ?
Is there an equivalent load in jquery?
or will multiple script src's be needed?
Where should the common js be in the name hierarchy?
is org.cometd.* OK?
should we use the openajax hub to avoid name clashes?
Can anybody think of a way to directly use common js
files like this, but to have the object created
directly into dojox.cometd or jquery.cometd names?
More information about the dojo-contributors