📝 Add docs on new auto updater API.

This commit is contained in:
Cheng Zhao 2014-02-02 20:37:46 +08:00
parent c13724b342
commit 45b626e0cc

View file

@ -1,42 +1,42 @@
# auto-updater # auto-updater
`auto-updater` module is a simple wrap around the Sparkle framework, it The `auto-updater` module is a simple wrap around the
provides auto update service for the application. [Squirrel](https://github.com/Squirrel/Squirrel.Mac) framework, you should
follow Squirrel's instructions on setting the server.
Before using this module, you should edit the `Info.plist` following ## Event: checking-for-update
https://github.com/andymatuschak/Sparkle/wiki.
## Event: will-install-update Emitted when checking for update has started.
## Event: update-available
Emitted when there is an available update, the update would be downloaded
automatically.
## Event: update-not-available
Emitted when there is no available update.
## Event: update-downloaded
* `event` Event * `event` Event
* `version` String * `releaseNotes` String
* `continueUpdate` Function * `releaseName` String
* `releaseDate` Date
This event is emitted when the update is found and going to be installed. * `updateUrl` String
Calling `event.preventDefault()` would pause it, and you can call
`continueUpdate` to continue the update.
## Event: ready-for-update-on-quit
* `event` Event
* `version` String
* `quitAndUpdate` Function * `quitAndUpdate` Function
This event is emitted when user chose to delay the update until the quit. Emitted when update has been downloaded, calling `quitAndUpdate()` would restart
Calling `quitAndUpdate()` would quit the application and install the update. the application and install the update.
## autoUpdater.setFeedUrl(url) ## autoUpdater.setFeedUrl(url)
* `url` String * `url` String
## autoUpdater.setAutomaticallyChecksForUpdates(flag) Set the `url` and initialize the auto updater. The `url` could not be changed
once it is set.
* `flag` Boolean
## autoUpdater.setAutomaticallyDownloadsUpdates(flag)
* `flag` Boolean
## autoUpdater.checkForUpdates() ## autoUpdater.checkForUpdates()
## autoUpdater.checkForUpdatesInBackground() Ask the server whether there is an update, you have to call `setFeedUrl` before
using this API.