MCPcopy
hub / github.com/angular-ui/ui-grid / completeTask

Function completeTask

lib/test/angular/1.8.0/angular.js:21295–21320  ·  view source on GitHub ↗
(fn, taskType)

Source from the content-addressed store, hash-verified

21293 self.notifyWhenNoPendingTasks = notifyWhenNoPendingTasks;
21294
21295 function completeTask(fn, taskType) {
21296 taskType = taskType || DEFAULT_TASK_TYPE;
21297
21298 try {
21299 fn();
21300 } finally {
21301 decTaskCount(taskType);
21302
21303 var countForType = taskCounts[taskType];
21304 var countForAll = taskCounts[ALL_TASKS_TYPE];
21305
21306 // If at least one of the queues (`ALL_TASKS_TYPE` or `taskType`) is empty, run callbacks.
21307 if (!countForAll || !countForType) {
21308 var getNextCallback = !countForAll ? getLastCallback : getLastCallbackForType;
21309 var nextCb;
21310
21311 while ((nextCb = getNextCallback(taskType))) {
21312 try {
21313 nextCb();
21314 } catch (e) {
21315 log.error(e);
21316 }
21317 }
21318 }
21319 }
21320 }
21321
21322 function decTaskCount(taskType) {
21323 taskType = taskType || DEFAULT_TASK_TYPE;

Callers

nothing calls this directly

Calls 2

decTaskCountFunction · 0.85
fnFunction · 0.70

Tested by

no test coverage detected