@@ -93,7 +93,7 @@ define(function (require, exports, module) {
9393 * determines what the spinner icon to show(green-for success), red-fail, blue normal based on the active
9494 * tasks in list and renders. IF the active tasks has already been notified, it wont notify again.
9595 */
96- function renderSpinnerIcon ( newTaskAdded ) {
96+ function renderSpinnerIcon ( showNormalSpinnerIfNone ) {
9797 let unackSuccessTaskFound = false ;
9898 if ( currentSpinnerType && currentSpinnerType !== SPINNER_NORMAL ) {
9999 // there is a success/fail spinner visible, clean it. For the normal spinner, it will be
@@ -116,7 +116,7 @@ define(function (require, exports, module) {
116116
117117 // for normal spinner, we dont show anything as its only shown briefly till SPINNER_HIDE_TIME
118118 // which was already handled, except when newTaskAdded
119- if ( newTaskAdded ) {
119+ if ( showNormalSpinnerIfNone ) {
120120 _showSpinnerIcon ( SPINNER_NORMAL ) ;
121121 }
122122 }
@@ -137,6 +137,7 @@ define(function (require, exports, module) {
137137 exports . taskSelect = taskSelect ;
138138 exports . SPINNER_HIDE_TIME = SPINNER_HIDE_TIME ;
139139 }
140+ hideSpinnerIcon ( ) ;
140141 }
141142 function _renderItem ( item , index ) {
142143 if ( item === Strings . STATUSBAR_TASKS_UNKNOWN_EXTENSION_TASK ) {
@@ -326,6 +327,7 @@ define(function (require, exports, module) {
326327 * @property {function(): void } hidePauseIcon - Hides the pause icon.
327328 * @property {function(string): void } showRestartIcon - Shows the restart (retry) icon with an optional tooltip message.
328329 * @property {function(): void } hideRestartIcon - Hides the restart (retry) icon.
330+ * @property {function(): void } flashSpinnerForAttention - briefly flashes the task spinner icon for attention.
329331 */
330332
331333 /**
@@ -343,6 +345,8 @@ define(function (require, exports, module) {
343345 * @param {Function } [options.onRetryClick] - Callback function triggered when the retry button is clicked.
344346 * @param {Function } [options.onSelect] - Callback function triggered when the task is selected from the dropdown.
345347 * @param {number } [options.progressPercent] - Initial progress percentage of the task.
348+ * @param {boolean } [options.noSpinnerNotification] - If set to true, will not show the task spinners for this task.
349+ * This can be used for silent background tasks where user attention is not needed.
346350 * @returns {TaskObject } Returns a task object with methods for updating the task's state and UI representation,
347351 * such as `setProgressPercent`, `setMessage`, `setSucceeded`, `setFailed`, and control visibility methods
348352 * like `showStopIcon`, `hideStopIcon`, etc.
@@ -378,7 +382,8 @@ define(function (require, exports, module) {
378382 onStopClick : null ,
379383 onRetryClick : null ,
380384 onSelect : null ,
381- progressPercent : null
385+ progressPercent : null ,
386+ noSpinnerNotification : false
382387 } ) {
383388 if ( ! taskTitle ) {
384389 throw new Error ( "taskTitle is required to call addNewTask" ) ;
@@ -399,8 +404,10 @@ define(function (require, exports, module) {
399404 _percent : options && options . progressPercent ,
400405 _completedStatus : STATUS_INCOMPLETE ,
401406 _iconHTML : iconHTML ,
402- _spinnerIconAck : false // This is set when the user has seen the spinner icon spinning and clicked to see
403- // weather the task succeeded or failed.
407+ _noSpinnerNotification : options && options . noSpinnerNotification ,
408+ _spinnerIconAck : options ? ! ! options . noSpinnerNotification : false
409+ // Spinner ack is set when the user has seen the spinner icon spinning and clicked to see
410+ // weather the task succeeded or failed. Some tasks may want to be silent by setting noSpinnerNotification.
404411 } ;
405412 function close ( ) {
406413 delete taskList [ task . _id ] ;
@@ -451,7 +458,9 @@ define(function (require, exports, module) {
451458 function setFailed ( ) {
452459 task . _completedStatus = STATUS_FAIL ;
453460 _renderProgressbar ( task ) ;
454- task . _spinnerIconAck = false ;
461+ if ( ! task . _noSpinnerNotification ) {
462+ task . _spinnerIconAck = false ;
463+ }
455464 renderSpinnerIcon ( ) ;
456465 }
457466 function isFailed ( ) {
@@ -460,7 +469,9 @@ define(function (require, exports, module) {
460469 function setSucceeded ( ) {
461470 task . _completedStatus = STATUS_SUCCESS ;
462471 _renderProgressbar ( task ) ;
463- task . _spinnerIconAck = false ;
472+ if ( ! task . _noSpinnerNotification ) {
473+ task . _spinnerIconAck = false ;
474+ }
464475 renderSpinnerIcon ( ) ;
465476 }
466477 function isSucceeded ( ) {
@@ -499,6 +510,9 @@ define(function (require, exports, module) {
499510 task . _showRestartIcon = null ;
500511 _renderPlayIcons ( task ) ;
501512 }
513+ function flashSpinnerForAttention ( ) {
514+ renderSpinnerIcon ( true ) ;
515+ }
502516
503517 task . show = show ;
504518 task . close = close ;
@@ -521,10 +535,15 @@ define(function (require, exports, module) {
521535 task . hidePauseIcon = hidePauseIcon ;
522536 task . showRestartIcon = showRestartIcon ;
523537 task . hideRestartIcon = hideRestartIcon ;
538+ task . flashSpinnerForAttention = flashSpinnerForAttention ;
524539 taskList [ task . _id ] = task ;
525540 EventDispatcher . makeEventDispatcher ( task ) ;
526541 _showOrHideStatusBarIfNeeded ( ) ;
527- renderSpinnerIcon ( true ) ;
542+ if ( ! task . _noSpinnerNotification ) {
543+ renderSpinnerIcon ( true ) ;
544+ } else {
545+ renderSpinnerIcon ( ) ;
546+ }
528547 return task ;
529548 }
530549
0 commit comments