Aaron,
> One question I have though is how we prevent multiple portlets from
> including the same resources multiple times? (Eg. if 5 portlets in
> the page all need dojo.js, then how do we prevent it from being
> needlessly included 5 times).
>
I had this same problem, and solved it as follows:
In dojo.js (or whatever), define your JavaScript functions as follows:
if (typeof(DOJOfunction1) == 'undefined')
{
DOJOfunction1 = function(arg1, arg2)
{
// define function 1 here
}
DOJOfunction2 = function(arg1, arg2, arg3)
{
// define function 2 here
}
// etc ...
}
As you can see, you need only one "if undefined" check for all the functions
in dojo.js. If you really want to, you can do a similar trick for each
function independently.
I know that this works for functions, but it might work for variables too (I
didn't have to try that).
Sadly, you're still including dojo.js 5 times, but the 2nd and subsequent
times, the "if undefined" check prevents the functions being included and
parsed more than once.
HTH.
Mike Church
Software Engineering
QinetiQ
Bldg Lovell Rm 109
Malvern Technology Centre
St. Andrews Road, Malvern
Worcestershire, WR14 3PS
Tel: 01684 896085
Email: [EMAIL PROTECTED]
Web: www.QinetiQ.com
QinetiQ - The Global Defence and Security Experts
The information contained in this E-Mail and any subsequent
correspondence is private and is intended solely for the intended
recipient(s). The information in this communication may be confidential
and/or legally privileged. Nothing in this e-mail is intended to
conclude a contract on behalf of QinetiQ or make QinetiQ subject to any
other legally binding commitments, unless the e-mail contains an express
statement to the contrary or incorporates a formal Purchase Order.
For those other than the recipient any disclosure, copying,
distribution, or any action taken or omitted to be taken in reliance on
such information is prohibited and may be unlawful.
Emails and other electronic communication with QinetiQ may be monitored
and recorded for business purposes including security, audit and
archival purposes. Any response to this email indicates consent to
this.
Telephone calls to QinetiQ may be monitored or recorded for quality
control, security and other business purposes.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]