[Dojo-interest] dojo.require() finds js file, but does not execute
it
Bodo Eing
eingb at uni-muenster.de
Mon Aug 7 09:42:05 MDT 2006
James Burke wrote:
> While that name might be a little long, perhaps a name change is worth
> it so people don't immediately think they need it for debugging. Maybe
> something like "includePackageDbg". It doesn't mention the actual
> complete word "debug" and having "include" in the name might relate it
> to dojo.hostenv.writeIncludes(). Or perhaps some other name? Shorten
> it even more to obscure it: incPkgDbg? pkgIncDbg?
>
> James
>
> On 8/5/06, Alex Russell <alex at dojotoolkit.org> wrote:
>> How many times do we have to cover "don't ask for help if your page
>> contains debugAtAllCosts"? Perhaps we should change the option name to
>> "dontEverUseThisFlag__andImSeriousThisTime__dontDoIt"
>>
>> Regards
>>
>> On Friday 04 August 2006 11:21 pm, James Burke wrote:
>> > Oh, looking at the original HTML, you should remove the
>> > debugAtAllCosts parameter from djConfig. There are other things you
>> > need to do in the page before you can use that option effectively,
>> > and it should be avoided unless you understand what it is doing under
>> > the covers.
>> >
>> > James
Thank you very much James. I am guilty having set a flag the effects of
which I was not fully aware (although I had read the respective docs and
even followed some related threads on this list before). There is no
excuse for it, but since this seems to be a frequent problem, there may
be some reasons for it:
- "debugAtAllCosts" screams for being set to true
- you can have it set to true without calling dojo.hostenv.writeIncludes
and without any trouble forever as long as you include your app with a
script tag and use a build comprising all packages you need. Newbies
like me may start to forget about this after some days, busy with the
rest of dojo.
- It is not intuitive to have a "configuration" setting requiring
conditional special action in your application code without any warnings
or errors if you forget this action.
Besides discussing an alternative name, why not let the browser_debug.js
version of dojo.hostenv.loadUri install an onload handler checking if
dojo.hostenc.writeIncludes has been called (dojo.hostenv.writeIncludes
must of course be modified to set a repective flag) ? The following
modifications in browser_debug.js worked for me (at least in my posted
testcase):
insert before the return statement in dojo.hostenv.loadUri:
if(!dojo.hostenv._writeIncludesControllerInstalled) {
dojo.addOnLoad(
function () {
if (!dojo.hostenv.writeIncludesCalled) {
alert("djConfig['debugAtAllCosts'] in effect but
dojo.hostenv.writeIncludes not called!")
}
}
);
dojo.hostenv._writeIncludesControllerInstalled = true;
}
insert after the last statement in dojo.hostenv.writeIncludes:
dojo.hostenv.writeIncludesCalled = true;
>>[ - snip - ]
BTW, I believe there is a typo in browser_debug.js:
var testExp =/dojo.(hostenv.loadModule|hosetnv.require|require| ....
^^^^^^^
Bodo
More information about the Dojo-interest
mailing list