# update-electron-app
> A drop-in module that adds autoUpdating capabilities to Electron apps
Powered by the free and open-source [update.electronjs.org](https://update.electronjs.org) service.
![screenshot](screenshot.png)
## Requirements
Before using this module, make sure your Electron app meets these criteria:
- Your app runs on macOS or Windows
- Your app has a public GitHub repository
- Your builds are published to GitHub Releases
- Your builds are [code signed]
## Installation
```sh
npm i update-electron-app
```
## Usage
Drop this anywhere in your main process:
```js
require('update-electron-app')()
```
That's it! Here's what happens by default:
- Repository URL is found in your app's `package.json` file.
- Your app will check for updates at startup, then every ten minutes. This interval is [configurable](#API).
- No need to wait for your app's `ready` event; the module figures that out.
- If an update is found, it will automatically be downloaded in the background.
- When an update is finished downloading, a dialog is displayed allowing the user to restart the app now or later.
You can also specify custom options:
```js
require('update-electron-app')({
repo: 'github-user/repo',
updateInterval: '1 hour',
logger: require('electron-log')
})
```
## API
### `update(options)`
Options:
- `repo` String (optional) - A GitHub repository in the format `owner/repo`. Defaults to your `package.json`'s `"repository"` field
- `host` String (optional) - Defaults to `https://update.electronjs.org`
- `updateInterval` String (optional) - How frequently to check for updates. Defaults to `10 minutes`. Minimum allowed interval is `5 minutes`.
- `logger` Object (optional) - A custom logger object that defines a `log` function. Defaults to `console`. See [electron-log](https://github.com/megahertz/electron-log), a module that aggregates logs from main and renderer processes into a single file.
- `notifyUser` Boolean (optional) - Defaults to `true`. When enabled the user will be
prompted to apply the update immediately after download.
## FAQ
#### What kinds of assets do I need to build?
For macOS, you'll need to build a `.zip` file and include it in your GitHub Release.
Use [electron-forge] or [electron-installer-zip] to package your app as a zip.
For Windows, you'll need to build a `.exe` file and include it in your GitHub Release.
#### Why is my app launching multiple times?
Windows apps have an update process that requires multiple application restarts.
You can use the [electron-squirrel-startup](https://github.com/mongodb-js/electron-squirrel-startup) module to improve this
behavior.
#### Can I use this module by uploading my private app's builds to a public GitHub repository?
Yes :)
## License
MIT
## See Also
If your app is packaged with `electron-builder`, you may not need this module.
Builder has its own built-in mechanism for updating apps. Find out more at
[electron.build/auto-update](https://www.electron.build/auto-update).
[electron-forge]: https://github.com/electron-userland/electron-forge
[electron-installer-zip]: https://github.com/mongodb-js/electron-installer-zip
[code signed]: https://github.com/electron/electron/blob/master/docs/tutorial/code-signing.md
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
可直接运行的Windows95(CPU:M系列) (383个子文件)
default-state.bin 54.83MB
v8_context_snapshot.arm64.bin 645KB
seabios.bin 128KB
vgabios.bin 35KB
chrome_crashpad_handler 909KB
CodeResources 83KB
CodeResources 24KB
CodeResources 3KB
CodeResources 2KB
CodeResources 2KB
CodeResources 2KB
CodeResources 2KB
CodeResources 2KB
CodeResources 2KB
CodeResources 2KB
95css.c51034cf.css 52KB
95css.css 52KB
root.f39bf48d.css 3KB
Current 1B
Current 1B
Current 1B
Current 1B
icudtl.dat 9.97MB
libvk_swiftshader.dylib 15.46MB
libGLESv2.dylib 8.54MB
libffmpeg.dylib 2.31MB
libEGL.dylib 272KB
Electron Framework 125.25MB
Electron Framework 35B
.eslintrc 180B
.eslintrc 35B
.gitattributes 12B
.gitignore 99B
Helpers 24B
index.html 3KB
index.html 477B
index.html 474B
tslib.es6.html 36B
tslib.html 32B
electron.icns 522KB
windows95.img 1024MB
_capstone-x86.min.js 2.07MB
_capstone-x86.min.js 2.07MB
_libwabt.js 1.22MB
_libwabt.js 1.22MB
react-dom.development.js 918KB
react-dom.development.js 874KB
libv86.js 368KB
libv86.js 368KB
react-dom-server.browser.development.js 143KB
react-dom-server.node.development.js 137KB
react-dom-server.browser.development.js 136KB
react-dom.profiling.min.js 122KB
react-dom.profiling.min.js 122KB
react-dom.production.min.js 118KB
react-dom.production.min.js 118KB
react.development.js 103KB
react-dom-test-utils.development.js 71KB
react.development.js 70KB
react-dom-test-utils.development.js 66KB
react-jsx-runtime.development.js 37KB
react-jsx-dev-runtime.development.js 37KB
app.15fac660.js 36KB
react-dom-server.node.production.min.js 20KB
react-dom-server.browser.production.min.js 20KB
react-dom-server.browser.production.min.js 20KB
scheduler-unstable_mock.development.js 18KB
scheduler.development.js 17KB
main.js 17KB
scheduler-unstable_mock.development.js 16KB
tslib.js 15KB
react-dom-test-utils.production.min.js 14KB
react-dom-test-utils.production.min.js 14KB
react.profiling.min.js 13KB
graceful-fs.js 12KB
tslib.es6.js 12KB
index.js 11KB
react.production.min.js 11KB
polyfills.js 10KB
scheduler-tracing.development.js 9KB
copy.js 8KB
rimraf.js 7KB
scheduler-unstable_post_task.development.js 7KB
react.production.min.js 6KB
node.js 6KB
copy-sync.js 6KB
stat.js 5KB
scheduler.development.js 5KB
scheduler.production.min.js 5KB
browser.js 5KB
gh.js 5KB
scheduler-unstable_mock.production.min.js 5KB
scheduler.profiling.min.js 5KB
scheduler.production.min.js 5KB
scheduler-unstable_mock.production.min.js 5KB
debug.js 4KB
index.js 4KB
index.js 4KB
commonjs.js 3KB
symlink-paths.js 3KB
共 383 条
- 1
- 2
- 3
- 4
资源评论
q130150155
- 粉丝: 1
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功