Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(http): onProgress param to sendRequest method #4512

Merged
merged 3 commits into from
Jul 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/@awesome-cordova-plugins/plugins/http/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';

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