Skip to content

Conversation

@Gongui
Copy link

@Gongui Gongui commented Dec 16, 2020

Fixes for problems 1 and 2 reported on issue #573

var gids = [];

var task = null;
for (let index = 0; index < tasks.length; index++) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use var index to replace let index. AriaNg also supports old browser that may not support let.

task = tasks[index];
if (state == 'start' && task.status != 'active' && task.status != 'waiting') {
gids.push(task.gid)
}else if (state == 'pause' && task.status != 'paused'){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format your code, missing two space
} else if (...
... !='paused') {

var task = null;
for (let index = 0; index < tasks.length; index++) {
task = tasks[index];
if (state == 'start' && task.status != 'active' && task.status != 'waiting') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use === instead of ==, !== instead of !=

contexts.push({
silent: !!context.silent,
gid: context.gids[i]
'methodName': 'aria2.forceRemove', 'params': [context.gids[i]]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can modify the variable name of contexts to methods, and it is more readable methods.push(this.forceRemove({ gid: context.gids[i] }, true))

the same below

}

return invokeMulti(this.forceRemove, contexts, context.callback);
return this.multicall({'methods': contexts});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return this.multicall({
    methods: methods,
    silent: !!context.silent
});

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the data structure in callback result may be different, you may need to modify the code in ariaTaskService.js(Line 831-833)

}

return invokeMulti(this.forcePause, contexts, context.callback);
return this.multicall({'methods': contexts});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may need to modify the code in main.js(Line 158-174)

}

return invokeMulti(this.unpause, contexts, context.callback);
return this.multicall({'methods': contexts});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may need to modify the code in main.js(Line 158-174)

}

return invokeMulti(this.removeDownloadResult, contexts, context.callback);
return this.multicall({'methods': contexts});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may need to modify the code in ariaTaskService.js(Line 843-845)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants