From bb41b5291765c3bda54d8a47eace7a3fb2ca219a Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 19 May 2018 16:22:32 +0800 Subject: [PATCH] command api supports pause new task --- src/scripts/controllers/command.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/scripts/controllers/command.js b/src/scripts/controllers/command.js index 4fd898f..ec4a996 100644 --- a/src/scripts/controllers/command.js +++ b/src/scripts/controllers/command.js @@ -13,6 +13,7 @@ } var options = {}; + var isPaused = false; if (params) { for (var key in params) { @@ -24,17 +25,25 @@ options[key] = params[key]; } } + + if (params.pause === 'true') { + isPaused = true; + } } $rootScope.loadPromise = aria2TaskService.newUriTask({ urls: [url], options: options - }, false, function (response) { + }, isPaused, function (response) { if (!response.success) { return false; } - $location.path('/downloading'); + if (isPaused) { + $location.path('/waiting'); + } else { + $location.path('/downloading'); + } }); ariaNgLogService.info('[CommandController] new download: ' + url);