Opened 14 years ago

Closed 14 years ago

#6727 closed enhancement (fixed)

Support djConfig.addOnLoad for use in the djConfig.afterOnLoad case.

Reported by: James Burke Owned by: James Burke
Priority: high Milestone: 1.2
Component: Loader Version: 1.1.0
Keywords: Cc:
Blocked By: Blocking:


Suggestion from Matthew Russell: it would be good to allow configuring a function to be fired once dojo is loaded when djConfig.afterOnLoad = true case, since it is difficult to know when dojo is ready when the script is in the HTML page doing the dojo.js node attachment.

I figured the general use case would be people putting their onload logic in a module that is loaded via djConfig.require in the dojo.afterOnLoad case, but having a djConfig option would help for cases like greasemonkey/bookmarklet links where you just want to embed your code with the code that does the dojo.js node attachment.

Thinking of just supporting djConfig.addOnload = function(){}. In hindsight, it would have been nice to name djConfig.afterOnLoad to something more boolean, isAfterLoad, isDelayed. Not too crazy about those names. Maybe isAfterLoad, but would like something shorter. Needs more thought.

For now:

1) just add djConfig.addOnLoad = function(){} support. Do the work in loader.js, right after the dojo.addOnLoad definition. We could support djConfig.addOnUnload too, but no, that work can be done in the user's djConfig.addOnLoad callback.

2) Be sure to add API docs for it in bootstrap.js (and add missing djConfig.afterOnLoad docs too).

Change History (2)

comment:1 Changed 14 years ago by James Burke

Owner: changed from alex to James Burke

To be clear, djConfig.addOnLoad should also work even when djConfig.afterOnLoad is not in play.

comment:2 Changed 14 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [13682]) Fixes #6727. Support a djConfig.addOnLoad option. Also updated API docs for djConfig.

Note: See TracTickets for help on using tickets.