Skip to content

Instantly share code, notes, and snippets.

@eduardolundgren
Last active December 25, 2015 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduardolundgren/6991456 to your computer and use it in GitHub Desktop.
Save eduardolundgren/6991456 to your computer and use it in GitHub Desktop.
async loop
_checkBackgroundTasks: function() {
var instance = this;
Liferay.Service(
'/backgroundtask/get-background-tasks-count',
{
groupId: instance._groupId,
taskExecutorClassName: instance._taskExecutorClassName,
completed: instance._isPending
},
function(obj) {
var warningMessageEl = A.oneNS(instance._namespace, '#warningMessageEl');
if (obj <= 0) {
if (warningMessageEl) {
warningMessageEl.show();
}
instance._stagingLink.hide();
if (!instance._timeout) {
instance._timeout = setTimeout(instance._checkBackgroundTasks 10000);
}
}
else {
if (warningMessageEl){
warningMessageEl.hide();
}
instance._stagingLink.show();
instance._timeout.cancel();
}
}
);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment