Skip to content

Commit

Permalink
feat(ajax): Add option for streaming progress (#6001)
Browse files Browse the repository at this point in the history
* feat(ajax): New progress event streaming options

- Adds configuration for `includeDownloadProgress` and `includeUploadProgress` that will add streaming download and upload events (respectively) to the resulting observable.
- Removes two tests that are no longer relevant.
- Adds some additional documentation.
- Updates ajax tests to support EventTarget APIs on the mock XHR impl.
- Attempts to reduce the size of the ajax implementation.

* docs(ajax): Deprecate `progressSubscriber`
  • Loading branch information
benlesh committed Feb 9, 2021
1 parent 9acb950 commit 873e52d
Show file tree
Hide file tree
Showing 5 changed files with 484 additions and 106 deletions.
13 changes: 11 additions & 2 deletions api_guard/dist/types/ajax/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export interface AjaxConfig {
createXHR?: () => XMLHttpRequest;
crossDomain?: boolean;
headers?: Readonly<Record<string, any>>;
includeDownloadProgress?: boolean;
includeUploadProgress?: boolean;
method?: string;
password?: string;
progressSubscriber?: PartialObserver<ProgressEvent>;
Expand Down Expand Up @@ -43,13 +45,20 @@ export interface AjaxRequest {
}

export declare class AjaxResponse<T> {
readonly originalEvent: Event;
readonly loaded: number;
readonly originalEvent: ProgressEvent;
readonly request: AjaxRequest;
readonly response: T;
readonly responseType: XMLHttpRequestResponseType;
readonly status: number;
readonly total: number;
readonly type: string;
readonly xhr: XMLHttpRequest;
constructor(originalEvent: Event, xhr: XMLHttpRequest, request: AjaxRequest);
constructor(
originalEvent: ProgressEvent,
xhr: XMLHttpRequest,
request: AjaxRequest,
type?: string);
}

export interface AjaxTimeoutError extends AjaxError {
Expand Down

0 comments on commit 873e52d

Please sign in to comment.