Comments (2)
But I do not use any library or framework. It's pure / Vanilla JavaScript. Async/await functions are part of JavaScript https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
But if you peffer Promises, that is supposed to work either:
<!DOCTYPE html>
<html>
<head>
<title>Autoupdater Example (Script Strategy)</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<pre id="output"></pre>
<script>
const AutoUpdater = require( "nw-autoupdater" ),
updater = new AutoUpdater( require( "./package.json" ), {
strategy: "ScriptSwap"
}),
output = document.querySelector( "#output" );
output.innerHTML = `Application ver. ${nw.App.manifest.version}\n`;
// Download/unpack update if any available
updater.readRemoteManifest().then(( rManifest ) => {
updater.checkNewVersion( rManifest ).then(( needsUpdate ) => {
if ( !needsUpdate ) {
output.innerHTML += `\nApp is up to date...`;
return;
}
if ( !confirm( "New release is available. Do you want to upgrade?" ) ) {
return;
}
});
updater.download( rManifest ).then(( updateFile ) => {
updater.unpack( updateFile ).then(() => {
alert( `The application will automatically restart to finish installing the update` );
updater.restartToSwap();
});
});
});
// Subscribe for progress events
updater.on( "download", ( downloadSize, totalSize ) => {
output.innerHTML = `Downloading...`;
console.log( "download progress", Math.floor( downloadSize / totalSize * 100 ), "%" );
});
updater.on( "install", ( installFiles, totalFiles ) => {
output.innerHTML = `Installing...\n`;
console.log( "install progress", Math.floor( installFiles / totalFiles * 100 ), "%" );
});
</script>
</body>
</html>
from nw-autoupdater.
cool, thanks. Will try your updater in our app:) Seems I'm not keeping pace with progress
from nw-autoupdater.
Related Issues (20)
- App does not swap when built with https://github.com/evshiron/nwjs-builder-phoenix HOT 4
- App does not restart after exiting post update (LINUX) HOT 3
- freeze screen
- Failed to compile (with create-react-app) HOT 1
- App not swap with script
- app.bak file in the same directory with app on Mac
- Doesn't restart after update, but updates without problems HOT 1
- unable to do anything other than output.innerHTML=''
- Unable to update after packaging using InnoSetup
- Error during installation of an update (EMFILE: too many open files)
- damaged update file
- Script Strategy HOT 1
- Folder backup
- Unable to download from AWS Cloudfront URL
- License file is missing in repo HOT 1
- NWJS v0.41.2 (latest) structure changed (build with nwjs-builder-phoenix) HOT 1
- Can not support https request HOT 4
- The default script deletes ALL files in folder (Mac)
- Callback fuction not defined in nodejs - chmod inside linux.js(Version - 1.1.11) HOT 1
- Request to move repo under NW Userland
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nw-autoupdater.