Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#16727 closed enhancement (wontfix)

Add AMD loader micro API event 'moduleLoaded'

Reported by: danwallie Owned by: Rawld Gill
Priority: undecided Milestone: tbd
Component: Loader Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:


Add this line to the end of finishExec() in dojo.js (line 1174):

signal("moduleLoaded", [module.result, module.mid]);

By adding this event to the end of finishExec(), developers will be able to subscribe to notifications when individual modules are loaded. This need arose specifically so I would be able to tag modules with their id's using module.prototype for id-based routing and activation.


Change History (3)

comment:1 Changed 9 years ago by Rawld Gill

Resolution: wontfix
Status: newclosed

This is not part of the AMD spec. I also don't understand your use case (that's not a judgement as to its value, but rather that I don't have enough information). I'm (we are) very skeptical of adding new features to the loader that are not in the AMD standard unless there is a clear and important use case.

I would prefer you bring this up on the AMD mailing list. If you think this is really important for dojo, please provide further justification for the proposed extension.

comment:2 Changed 9 years ago by danwallie

I posted here about this:;cid=1364236786172-513

Is there another more appropriate place to discuss?

comment:3 Changed 9 years ago by danwallie

I think I have the wrong mailing list. Nobody seems to be talking about AMD there. Can you please point me to the right one?

I cam also provide some more information here on the use case. I am using a different web framework, Durandal.js, to handle MVC type composition and routing. This framework needs to be able to load AMD modules as models for views, and it uses a string property to tag the modules so a view's model can be located by convention (i.e. an abstraction). The tag is applied to the module's prototype when the loader has finished loading the module. In require.js, this is accomplished via the semi-private onModuleLoad API, documented here:

I believe that this event is important for making dojo compatible with these types of frameworks.


Note: See TracTickets for help on using tickets.