Skip to content

Commit 4cd48b4

Browse files
authored
feat(http): onProgress param to sendRequest method (#4512)
* feat(http): add onProgress callback to uploadFile and downloadFile * feat(http): add uploadFileWithOptions and downloadFileWithOptions methods * add onProgress to sendRequest
1 parent baa207b commit 4cd48b4

File tree

1 file changed

+7
-0
lines changed
  • src/@awesome-cordova-plugins/plugins/http

1 file changed

+7
-0
lines changed

src/@awesome-cordova-plugins/plugins/http/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { Injectable } from '@angular/core';
22
import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
33

4+
export interface OnProgress {
5+
isProgress: boolean;
6+
transferred: number;
7+
total: number;
8+
}
49
export interface HTTPResponse {
510
/**
611
* The HTTP status number of the response or a negative internal error code.
@@ -608,6 +613,7 @@ export class HTTP extends AwesomeCordovaNativePlugin {
608613
* @param options.filePath {string} file path(s) to be used during upload and download see uploadFile and downloadFile for detailed information
609614
* @param options.name {string} name(s) to be used during upload see uploadFile for detailed information
610615
* @param options.responseType {string} response type, defaults to text
616+
* @param options.onProgress {function} A callback that is called when is progress
611617
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
612618
*/
613619
@Cordova()
@@ -623,6 +629,7 @@ export class HTTP extends AwesomeCordovaNativePlugin {
623629
filePath?: string | string[];
624630
name?: string | string[];
625631
responseType?: 'text' | 'arraybuffer' | 'blob' | 'json';
632+
onProgress?: (response: OnProgress) => void;
626633
}
627634
): Promise<HTTPResponse> {
628635
return;

0 commit comments

Comments
 (0)