0.0.1 • Published 6 years ago

electron-update-app-asar v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

electron autoupdate app.asar

set code in index.html

    const EAU = require('electron-update-app-asar');
    EAU.init({
        api: 'http://localhost/update/latest.json',
        appPath: __dirname
    });
    window.checkForUpdates = function() {
        EAU.check(function(error) {
            if (error) {
                if (error != 'no_update_available') {
                    alert(error);
                }
            } else {
                var apply = confirm("New Update Available.\nWould you like to update?");
                if (apply == true) {
                    EAU.download(function(error) {
                        if (error) {
                            alert(error);
                        } else {
                            alert('App updated successfully! Restart it please.');
                        }
                    });
                }
            }
        });
    }
    checkForUpdates();

set code in latest.json

{"version": "0.0.1", "url": "http://localhost/update/app.asar"}