Skip to content

Commit 46e9e87

Browse files
committed
can cancel paused
1 parent 3ea0130 commit 46e9e87

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

dist/cos-js-sdk-v5.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15275,7 +15275,7 @@ var initTask = function (cos) {
1527515275
var task = tasks[id];
1527615276
var waiting = task && task.state === 'waiting';
1527715277
var running = task && (task.state === 'checking' || task.state === 'uploading');
15278-
if (waiting || running) {
15278+
if (waiting || running || switchToState === 'canceled' && task.state === 'paused') {
1527915279
if (switchToState === 'paused' && task.params.Body && typeof task.params.Body.pipe === 'function') {
1528015280
console.error('stream not support pause');
1528115281
return;
@@ -15287,7 +15287,7 @@ var initTask = function (cos) {
1528715287
uploadingFileCount--;
1528815288
startNextTask(cos);
1528915289
}
15290-
if (switchToState === 'cancel') {
15290+
if (switchToState === 'canceled') {
1529115291
delete task.params;
1529215292
delete task.callback;
1529315293
}

dist/cos-js-sdk-v5.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/task.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var initTask = function (cos) {
5656
var task = tasks[id];
5757
var waiting = task && task.state === 'waiting';
5858
var running = task && (task.state === 'checking' || task.state === 'uploading');
59-
if (waiting || running) {
59+
if (waiting || running || (switchToState === 'canceled' && task.state === 'paused')) {
6060
if (switchToState === 'paused' && task.params.Body && typeof task.params.Body.pipe === 'function') {
6161
console.error('stream not support pause');
6262
return;
@@ -68,7 +68,7 @@ var initTask = function (cos) {
6868
uploadingFileCount--;
6969
startNextTask(cos);
7070
}
71-
if (switchToState === 'cancel') {
71+
if (switchToState === 'canceled') {
7272
delete task.params;
7373
delete task.callback;
7474
}

0 commit comments

Comments
 (0)