Q:

Javascript - Windows Store - Forcing Mandatory Update

Javascript:
I want my Windows Store app to check for updates, especially mandatory ones, and then prompt the user to update.
I have found out this involves Windows.Services.Store, but I cannot find any javascript examples of how this is done, only the usual c#/vb ones.
Does anyone know of a code template?

A:

I have found out this involves Windows.Services.Store, but I cannot find any javascript examples of how this is done, only the usual c#/vb ones.

I'd suppose the examples you've found are Code examples in Download and install package updates for your app. Although, these examples are written with C#, but we can convert them to JavaScript easily as most of them are Windows Runtime APIs. 
Using Download and install all package updates for example, the JavaScript version would like the following:
var context = Windows.Services.Store.StoreContext.getDefault();

context.getAppAndOptionalStorePackageUpdatesAsync().then(function (updates) {
    if (updates.size > 0) {
        var dialog = new Windows.UI.Popups.MessageDialog("Download and install updates now? This may cause the application to exit.", "Download and Install?");
        dialog.commands.append(new Windows.UI.Popups.UICommand("Yes"));
        dialog.commands.append(new Windows.UI.Popups.UICommand("No"));
        dialog.showAsync().then(function (command) {
            if (command.label === "Yes") {
                context.requestDownloadAndInstallStorePackageUpdatesAsync(updates).then(function (result) {
                    // TODO
                }, function (error) {
                    //TODO
                }, function (progress) {
                    var downloadProgressBar = document.getElementById("downloadProgressBar");
                    downloadProgressBar.value = progress.packageDownloadProgress;
                });
            }
        });
    }
});

Two major differences between C# and JavaScript version here are casing conventions and asynchronous methods. For more info, please see Using the Windows Runtime in JavaScript.

