It sounds as though your module is a singleton instead of an instance. Is that true? If you create an instance-based module, the module will be created anew each time it's activated. That will cause the compositionComplete
to re-execute.
The activate
handler is good for preparing data that will ultimately be displayed in the view. compositionComplete
is best for handling matters that depend on a fully-constructed DOM.
We use Bing Maps AJAX v7 as well, and I've always placed it in an instance-based module.
To create an instance-based module, if you're not familiar, make sure your viewmodel returns a constructor function instead of an object literal.