Skip to content

Commit

Permalink
docs: refine API docs for files in features dir
Browse files Browse the repository at this point in the history
  • Loading branch information
devvaannsh committed Oct 26, 2024
1 parent 085a4a4 commit 626b88c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
43 changes: 32 additions & 11 deletions docs/API-Reference/features/TaskManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,26 @@ const TaskManager = brackets.getModule("features/TaskManager")
<a name="module_features/TaskManager"></a>

## features/TaskManager
TaskManager module deals with managing long running tasks in phcode. It handles the `Tasks` dropdown in the statusbar where the user can see all running tasks, monitor its progress and close/pause the execution of the task ifsupported 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) ⇒ <code>TaskObject</code>
* [.TaskObject](#module_features/TaskManager..TaskObject) : <code>Object</code>

<a name="module_features/TaskManager..renderSpinnerIcon"></a>

### features/TaskManager.renderSpinnerIcon()
determines what the spinner icon to show(green-for success), red-fail, blue normal based on the activetasks in list and renders. IF the active tasks has already been notified, it wont notify again.

**Kind**: inner method of [<code>features/TaskManager</code>](#module_features/TaskManager)
<a name="module_features/TaskManager..addNewTask"></a>

### features/TaskManager.addNewTask(taskTitle, message, [iconHTML], [options]) ⇒ <code>TaskObject</code>
The addNewTask is designed for adding new tasks to the task management system. This function is central tomanaging long-running tasks, providing a way to visually represent task progress, status, and control actionsdirectly 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 [<code>features/TaskManager</code>](#module_features/TaskManager)
**Returns**: <code>TaskObject</code> - Returns a task object with methods for updating the task's state and UI representation,such as `setProgressPercent`, `setMessage`, `setSucceeded`, `setFailed`, and control visibility methodslike `showStopIcon`, `hideStopIcon`, etc.
**Returns**: <code>TaskObject</code> - 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 |
| --- | --- | --- | --- |
Expand All @@ -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 handlersconst task = TaskManager.addNewTask( 'Data Processing', 'Processing data...', '<i class="fa fa-spinner fa-spin"></i>', { 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 progresstask.setProgressPercent(60);// Updating task messagetask.setMessage('60% completed');// Marking task as succeededtask.setSucceeded();
// Example: Adding a new task with initial progress and attaching event handlers
const task = TaskManager.addNewTask(
'Data Processing',
'Processing data...',
'<i class="fa fa-spinner fa-spin"></i>',
{
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();
```
<a name="module_features/TaskManager..TaskObject"></a>

Expand Down
1 change: 1 addition & 0 deletions src/features/TaskManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 626b88c

Please sign in to comment.