Bootstrap
You can use Bootstraps to update users’ Launchers. It is recommended to use this class to check for updates and update the Launcher at the start of the application.
Warning
Bootstraps requires an EML AdminTool website to work.
Warning
Bootstraps requires Electron and Electron updater! Please install them with npm i electron-updater.
import { Bootstraps } from 'eml-lib'
bootstraps()
async function bootstraps() {
const bootstraps = new Bootstraps('https://at.emlproject.pages.dev')
try {
const update = await bootstraps.checkForUpdate()
if (update.updateAvailable) {
bootstraps.on('download_end', (data) => {
update.runUpdate()
})
await bootstraps.download()
}
} catch (err) {
console.error(err)
}
} Bootstraps constructor
| Parameter | Type | Description | Required? |
|---|---|---|---|
url | string | The URL of your EML AdminTool website. | Yes |
Bootstraps.checkForUpdate() method
Check for updates.
Returns: Promise<IBootstraps> The bootstraps files information and version if an update is available.
Throws: FETCH_ERROR - If the request to the EML AdminTool website fails.
Bootstraps.download() method
Download the update found by Bootstraps.checkForUpdate().
Returns: Promise<string> - The path to the downloaded update.
Throws: DOWNLOAD_ERROR - If an error occurs while downloading the update.
Emits: download_progress - The update is downloading. • download_error - Error while downloading the update. • download_end - The update is downloaded.
Bootstraps.runUpdate() method
Quit the application and install the update.
| Parameter | Type | Description | Required? |
|---|---|---|---|
silent | boolean | (Windows-only) Runs the installer in silent mode. | No (default is false) |
Throws: bootstraps_error - If the update execution fails.