MCPcopy Create free account
hub / github.com/choosehappy/QuickAnnotator / completeTask

Function completeTask

static/js/angular.js:21230–21255  ·  view source on GitHub ↗
(fn, taskType)

Source from the content-addressed store, hash-verified

21228 self.notifyWhenNoPendingTasks = notifyWhenNoPendingTasks;
21229
21230 function completeTask(fn, taskType) {
21231 taskType = taskType || DEFAULT_TASK_TYPE;
21232
21233 try {
21234 fn();
21235 } finally {
21236 decTaskCount(taskType);
21237
21238 var countForType = taskCounts[taskType];
21239 var countForAll = taskCounts[ALL_TASKS_TYPE];
21240
21241 // If at least one of the queues (`ALL_TASKS_TYPE` or `taskType`) is empty, run callbacks.
21242 if (!countForAll || !countForType) {
21243 var getNextCallback = !countForAll ? getLastCallback : getLastCallbackForType;
21244 var nextCb;
21245
21246 while ((nextCb = getNextCallback(taskType))) {
21247 try {
21248 nextCb();
21249 } catch (e) {
21250 log.error(e);
21251 }
21252 }
21253 }
21254 }
21255 }
21256
21257 function decTaskCount(taskType) {
21258 taskType = taskType || DEFAULT_TASK_TYPE;

Callers

nothing calls this directly

Calls 2

decTaskCountFunction · 0.85
fnFunction · 0.70

Tested by

no test coverage detected