Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sunzongzheng/electron-updater
Do not need code signing anymore
https://github.com/sunzongzheng/electron-updater
Last synced: about 2 months ago
JSON representation
Do not need code signing anymore
- Host: GitHub
- URL: https://github.com/sunzongzheng/electron-updater
- Owner: sunzongzheng
- Created: 2018-06-15T10:58:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-07T10:02:07.000Z (over 6 years ago)
- Last Synced: 2024-10-03T17:36:36.432Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 18
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Electron-updater
## Feature
- same api like [electron-userland/electron-builder](https://github.com/electron-userland/electron-builder/tree/master/packages/electron-updater)
- do not need code siging for mac
- platform
- Mac (zip)
- Windows (exe)
- Linux (AppImage)
- methods
- github release
- custom
- node >= 8## Usage
````js
import autoUpdater from '@suen/electron-updater'/* when use github release */
const update = autoUpdater({
type: 'github',
options: {
username: 'your github username',
repo: 'your repo',
log: true // will emit log event
}
})
/* when use custorm url */
const update = autoUpdater({
type: 'custom',
options: {
url: 'you custom url', // need https
log: true // will emit log event
}
})
/* when use custorm getRemoteLatest function */
const update = autoUpdater({
type: 'custom',
options: {
getRemoteLatest() {
return new Promise((resolve) => {
this.latestRelease.linux = 'linux download url'
this.latestRelease.osx = 'osx download url'
this.latestRelease.windows = 'windows download url'
this.latestVersion = 'v1.0.0' // it decides your downloaded file name, will be helpful on linux
this.emit('log', this.latestRelease)
resolve(100000000) // your version num, must be an number
})
},
log: true // will emit log event
}
})update.checkForUpdatesAndNotify()
````## Event
- checking-for-update
- update-available
- update-not-available
- download-progress
- error
- logexample:
````js
update.on('checking-for-update', () => {
mainWindow.webContents.send('checking-for-update')
})update.on('update-available', () => {
mainWindow.webContents.send('update-available')
})update.on('update-not-available', () => {
mainWindow.webContents.send('update-not-available')
})update.on('download-progress', (percent) => {
mainWindow.webContents.send('download-progress', `${percent}%`)
})update.on('error', (e) => {
mainWindow.webContents.send('error', e)
})update.on('log', (log) => {
mainWindow.webContents.send('log', log)
})
````