The following code works flawlessly when run in debug mode (F5) .. but when deployed (as a app tile) or run without the debugger (ctl+f5), it does not work properly.
behaviour expected/ when working: clicking the tile launches the steam url link immediately, without rendering the html page visibly.
behaviour received/ not working: clicking the tile launches the app, only rendering the html page and never launches the steam url.
var mydefs = new Object();
mydefs = { url: 'steam://rungameid/200710' };
function launch(url) {
var uri = new Windows.Foundation.Uri(url);
Windows.System.Launcher.launchUriAsync(uri).then(
function (success) {
if (success) {
// File launched
window.close();
} else {
// File launch failed
}
});
}
(function () {
"use strict";
WinJS.Binding.optimizeBindingReferences = true;
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
launch(mydefs.url);
args.setPromise(WinJS.UI.processAll());
}
};
app.oncheckpoint = function (args) {
window.close();
};
app.start();
})();
Looks like a timing issue. The following works for me as a tile