updateready event

Event fired when AppUpdate has a newly downloaded update available.

A default handler is already added to sap.AppUpdate.onupdateready that will ask the user to reload the app. When handling this event you should call sap.AppUpdate.reloadApp() to apply the downloaded update.

Properties

Name Type Default Description
type string undefined The name of the event.Value will be updateready.
revision int undefined The revision that was downloaded.

Type

object

Example

// This will listen for updateready event.  
// Note: Use sap.AppUpdate.onupdateready if you want to override the default handler.
sap.AppUpdate.addEventListener('updateready', function(e) {
    console.log("Update ready");
});

// Override default handler so that we automatically load the update 
// without first prompting the user for permission,
sap.AppUpdate.onupdateready = function(e) {
    // No notification just reload
    console.log("Apply application update...");
    sap.AppUpdate.reloadApp();
};

// Override default handler with custom prompt to warn the user that the 
// application is ready to update.
sap.AppUpdate.onupdateready = function() {
    console.log("Confirming application update…");
    navigator.notification.confirm('Update Available',
       function(buttonIndex) {
           if (buttonIndex === 2) {
               console.log("Applying application update…");
               sap.AppUpdate.reloadApp();
           }
       }, 
       "Update", ["Later", "Relaunch Now"]);
};

Source

appupdate.js, line 171.