Skip to content

Commit

Permalink
fix: add definition for download event
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Mar 22, 2022
1 parent 5a56092 commit 9f647be
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
import type { PluginListenerHandle } from '@capacitor/core';

export interface DownloadEvent {
/**
* Current status of download, between 0 and 100.
*
* @since 2.0.11
*/
percent: number;
}

export type DownloadChangeListener = (state: DownloadEvent) => void;
export interface CapacitorUpdaterPlugin {
/**
* Download a new version from the provided URL, it should be a zip file, with files inside or with a unique folder inside with all your files
Expand Down Expand Up @@ -58,4 +70,14 @@ export interface CapacitorUpdaterPlugin {
* @returns {Promise<void>} an Promise resolved directly
*/
cancelDelay(): Promise<void>;

/**
* Listen for download event in the App, let you know when the download is started, loading and finished
*
* @since 2.0.11
*/
addListener(
eventName: 'download',
listenerFunc: DownloadChangeListener,
): Promise<PluginListenerHandle> & PluginListenerHandle;
}

0 comments on commit 9f647be

Please sign in to comment.