Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8e8bb1d

Browse files
committed
progress event handler
1 parent 48cf70c commit 8e8bb1d

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

‎controls/base/src/ajax.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class Ajax {
2020
* Specifies the URL to which request to be sent.
2121
* @default null
2222
*/
23-
public url: string | ((data: string | Object) => Promise<void>);
23+
public url: string | ((data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>);
2424
/**
2525
* Specifies which HTTP request method to be used. For ex., GET, POST
2626
* @default GET
@@ -152,7 +152,15 @@ export class Ajax {
152152
if (!loadEvent) {
153153
return;
154154
}
155-
await url(this.data);
155+
await url(this.data, progress => {
156+
let progressEvent = new ProgressEvent('progress', progress);
157+
if (!isNullOrUndefined(this.onProgress)) {
158+
this.onProgress.call(this.httpRequest, progressEvent);
159+
}
160+
if (!isNullOrUndefined(this.onUploadProgress)) {
161+
this.onUploadProgress.call(this.httpRequest, progressEvent);
162+
}
163+
});
156164
resolve(this.successHandler(undefined));
157165
}).catch((err: any) => {
158166
if (this.emitError) {

‎controls/filemanager/src/file-manager/models/ajax-settings-model.d.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ export interface AjaxSettingsModel {
2222
* @default null
2323
*/
2424
uploadUrl?: string | {
25-
remove: (data: string | Object) => Promise<void>;
26-
save: (data: string | Object) => Promise<void>;
25+
remove: (data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>;
26+
save: (data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>;
2727
};
2828

2929
/**
3030
* Specifies URL to read the files from server.
3131
* @default null
3232
*/
33-
url?: string | ((data: string | Object) => Promise<void>);
33+
url?: string | ((data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>);
3434

3535
}

‎controls/filemanager/src/file-manager/models/ajax-settings.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ export class AjaxSettings extends ChildProperty<AjaxSettings> {
2424
*/
2525
@Property(null)
2626
public uploadUrl: string | {
27-
remove: (data: string | Object) => Promise<void>;
28-
save: (data: string | Object) => Promise<void>;
27+
remove: (data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>;
28+
save: (data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>;
2929
};
3030

3131
/**
3232
* Specifies URL to read the files from server.
3333
* @default null
3434
*/
3535
@Property(null)
36-
public url: string | ((data: string | Object) => Promise<void>);
36+
public url: string | ((data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>);
3737
}
3838

‎controls/inputs/src/uploader/uploader-model.d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ export interface AsyncSettingsModel {
6363
* The upload operations could not perform without this property.
6464
* @default ''
6565
*/
66-
saveUrl?: string | ((data: string | Object) => Promise<void>);
66+
saveUrl?: string | ((data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>);
6767

6868
/**
6969
* Specifies the URL of remove action that receives the file information and handle the remove operation in server.
7070
* The remove action type must be POST request and define "removeFileNames" attribute to get file information that will be removed.
7171
* This property is optional.
7272
* @default ''
7373
*/
74-
removeUrl?: string | ((data: string | Object) => Promise<void>);
74+
removeUrl?: string | ((data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>);
7575

7676
/**
7777
* Specifies the chunk size to split the large file into chunks, and upload it to the server in a sequential order.

‎controls/inputs/src/uploader/uploader.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ export class AsyncSettings extends ChildProperty<AsyncSettings> {
9898
* @default ''
9999
*/
100100
@Property('')
101-
public saveUrl: string | ((data: string | Object) => Promise<void>);
101+
public saveUrl: string | ((data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>);
102102
/**
103103
* Specifies the URL of remove action that receives the file information and handle the remove operation in server.
104104
* The remove action type must be POST request and define "removeFileNames" attribute to get file information that will be removed.
105105
* This property is optional.
106106
* @default ''
107107
*/
108108
@Property('')
109-
public removeUrl: string | ((data: string | Object) => Promise<void>);
109+
public removeUrl: string | ((data: string | Object,onProgress: (progress: ProgressEventInit)=>void) => Promise<void>);
110110
/**
111111
* Specifies the chunk size to split the large file into chunks, and upload it to the server in a sequential order.
112112
* If the chunk size property has value, the uploader enables the chunk upload by default.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /