diff --git a/docs/API-Reference/features/TaskManager.md b/docs/API-Reference/features/TaskManager.md index 42f43ff384..fdb774bd3c 100644 --- a/docs/API-Reference/features/TaskManager.md +++ b/docs/API-Reference/features/TaskManager.md @@ -6,27 +6,26 @@ const TaskManager = brackets.getModule("features/TaskManager") ## features/TaskManager -TaskManager module deals with managing long running tasks in phcode. It handles the `Tasks` dropdown in the status bar where the user can see all running tasks, monitor its progress and close/pause the execution of the task if supported by the task. +TaskManager module deals with managing long running tasks in phcode. It handles the `Tasks` dropdown in the status +bar where the user can see all running tasks, monitor its progress and close/pause the execution of the task if +supported by the task. * [features/TaskManager](#module_features/TaskManager) - * [.renderSpinnerIcon()](#module_features/TaskManager..renderSpinnerIcon) * [.addNewTask(taskTitle, message, [iconHTML], [options])](#module_features/TaskManager..addNewTask) ⇒ TaskObject * [.TaskObject](#module_features/TaskManager..TaskObject) : Object - - -### features/TaskManager.renderSpinnerIcon() -determines what the spinner icon to show(green-for success), red-fail, blue normal based on the active tasks in list and renders. IF the active tasks has already been notified, it wont notify again. - -**Kind**: inner method of [features/TaskManager](#module_features/TaskManager) ### features/TaskManager.addNewTask(taskTitle, message, [iconHTML], [options]) ⇒ TaskObject -The addNewTask is designed for adding new tasks to the task management system. This function is central to managing long-running tasks, providing a way to visually represent task progress, status, and control actions directly from the UI in the status bar. +The addNewTask is designed for adding new tasks to the task management system. This function is central to +managing long-running tasks, providing a way to visually represent task progress, status, and control actions +directly from the UI in the status bar. **Kind**: inner method of [features/TaskManager](#module_features/TaskManager) -**Returns**: TaskObject - Returns a task object with methods for updating the task's state and UI representation, such as `setProgressPercent`, `setMessage`, `setSucceeded`, `setFailed`, and control visibility methods like `showStopIcon`, `hideStopIcon`, etc. +**Returns**: TaskObject - Returns a task object with methods for updating the task's state and UI representation, +such as `setProgressPercent`, `setMessage`, `setSucceeded`, `setFailed`, and control visibility methods +like `showStopIcon`, `hideStopIcon`, etc. | Param | Type | Default | Description | | --- | --- | --- | --- | @@ -44,7 +43,29 @@ The addNewTask is designed for adding new tasks to the task management system. T **Example** ```js -// Example: Adding a new task with initial progress and attaching event handlers const task = TaskManager.addNewTask( 'Data Processing', 'Processing data...', '', { onPauseClick: () => console.log('Task paused'), onPlayClick: () => console.log('Task resumed'), onStopClick: () => console.log('Task stopped'), onRetryClick: () => console.log('Task retried'), onSelect: () => console.log('Task selected'), progressPercent: 20 } ); // Updating task progress task.setProgressPercent(60); // Updating task message task.setMessage('60% completed'); // Marking task as succeeded task.setSucceeded(); +// Example: Adding a new task with initial progress and attaching event handlers +const task = TaskManager.addNewTask( + 'Data Processing', + 'Processing data...', + '', + { + onPauseClick: () => console.log('Task paused'), + onPlayClick: () => console.log('Task resumed'), + onStopClick: () => console.log('Task stopped'), + onRetryClick: () => console.log('Task retried'), + onSelect: () => console.log('Task selected'), + progressPercent: 20 + } +); + +// Updating task progress +task.setProgressPercent(60); + +// Updating task message +task.setMessage('60% completed'); + +// Marking task as succeeded +task.setSucceeded(); ``` diff --git a/src/features/TaskManager.js b/src/features/TaskManager.js index 8158b8346a..c1450e2c0c 100644 --- a/src/features/TaskManager.js +++ b/src/features/TaskManager.js @@ -92,6 +92,7 @@ define(function (require, exports, module) { /** * determines what the spinner icon to show(green-for success), red-fail, blue normal based on the active * tasks in list and renders. IF the active tasks has already been notified, it wont notify again. + * @private */ function renderSpinnerIcon(showNormalSpinnerIfNone) { let unackSuccessTaskFound = false;