du.system.version
Module for managing version checking and version updates. Version update is done by regularly checking the current version of the app (stored in the HTML5 local storage) against a file that contains the latest version number. This requires a version file to be updated on version update. The version file is a JSON with a single key 'version' and the version code in major.minor.patch string format. Default path to the version file is 'data/version.json'. On first call, the constructor checks for version update right away.file
du.system.version.file(path)
Sets the version resource file.
| arg | type | description |
|---|---|---|
| path | string | Path to the version file. |
check
du.system.version.check([onUpdate[, regular]])
Checks latest version and updates page if it is higher than current version. If no version file is found, 0.0.1 is used (lowest possible). Also, if delay is specified, regular check for version update is enabled.
| arg | type | description |
|---|---|---|
| onUpdate | function | Callback to perform on version update. The function must accept two parameters: latest and current for the latest and current version numbers. optional |
| regular | boolean | Turns on regular checks for version updates around every 30 minutes. optional |
current
du.system.version.current()
Returns the current version. If version is not yet set in local storage, it is initialized to 0.0.1.
| return | description |
|---|---|
string | Current version in string format. |