WinJS -- default.js not refactorable to true AMD style: onactivated event does not fire - by PaulChristopher

Status : 

  External<br /><br />
		This item may be valid but belongs to an external system out of the direct control of this product team.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 773996 Comments
Status Resolved Workarounds
Type Bug Repros 0
Opened 12/11/2012 12:10:04 AM
Access Restriction Public


It is often mentioned in official Microsoft talks or books, that WinJS can be used together with an AMD loader. However if you refactor default.js to true AMD style, it does not work (see test case below): Of course the loader defers the application startup and app.start is called when all modules have been loaded. But this seems to be to late for WinJS: The only event that gets fired, is a "loaded event". The activated event is completely lost.
Sign in to post a comment.
Posted by Jordan [MSFT] on 1/18/2013 at 9:45 AM
I was able to repro the issue. It looks like the initialization code run by the dijit library yields and subsequently we miss the app.activated event and don’t re-raise it. I’ve opened a bug for WinJS to examine if we can fix the issue in the next version.

In the meantime, there’s a reasonable workaround here ( that involves moving your require declaration into the ready handler. While it doesn’t match the common AMD pattern, I hope this workaround will work for you for now.

Much thanks for reporting this; we want to ensure WinJS works well with other libraries, including Dojo.
Posted by PaulChristopher on 1/16/2013 at 12:21 AM
phuff, thank you for your feedback. Alas, the problem still exists for me. As you suggested: I have mailed you a zipped project file. Hopefully you can reproduce the issue. I am using Microsoft Visual Studio Express 2012 for Win8 Version 11.0.51106.01 Update 1 (Mircosoft .Net Framework Version 4.5.50709), Dojo 1.8.1.
Posted by Jordan [MSFT] on 1/11/2013 at 2:13 PM
Thank you for reporting this issue, PaulChristopher. We tried to reproduce this issue with the code you provided, but we see all the events raised, including activated. If you are still seeing this issue, please mail a zipped project file that reproduces the bug to phuff -at- Microsoft -dot- com and we’ll investigate your repro directly.
Posted by PaulChristopher on 12/13/2012 at 2:36 AM
Closing this ticket without any comment and declaring it as "not our problem" is not very helpful. Apparently the onactivated event is not correctly queued if the app's startup is delayed by a third party library, in this case: an AMD loader.

This Microsoft book mentions that you can use Dojo Toolkit and AMD loaders:

Has this been thoroughly tested?

Please give some feedback on how this issue can be resolved and what needs to be changed in the third party library.
Posted by Helen [MSFT] on 12/11/2012 at 1:53 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Macy [MSFT] on 12/11/2012 at 12:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(