← offliner-updater-reinstall.js |
|
---|---|
How to write an update implementation |
|
Remember including offliner will export the |
|
Should check for the latest version. It must return a promise resolving with a version tag, which is a string representing the version. |
|
For this demo we are checking the hash of the HEAD of gh-pages branch on GitHub. We will use the free GitHub API for that end. |
|
api.github.com/' + path; |
|
Once we know the API URL, simply fetch and extract the hash field from the response. |
|
Should check if the version from the step above is a new version given the current one. Notice offliner is not aware about the meaning of your versions but you could write middleware understanding semver for instance. |
|
The update process set some flags you can check in the |
|
We have a new version every time the hash changes. |
|
Should implement how to update the current cache. |
|
The callback |
|
Of course you can provide as many extra functions as you need. |
|