Allow alternate API to Dataspace.backgroundTask

This commit is contained in:
Tony Garnock-Jones 2018-11-02 17:06:27 +00:00
parent 9e41d8754c
commit 95f8e881d2
1 changed files with 3 additions and 2 deletions

View File

@ -113,12 +113,13 @@ Dataspace.backgroundTask = function (k) {
let ground = Dataspace._currentFacet.actor.dataspace.container;
let active = true;
ground.backgroundTaskCount++;
return k(() => {
function finish() {
if (active) {
ground.backgroundTaskCount--;
active = false;
}
});
}
return k ? k(finish) : finish;
};
Dataspace.referenceField = function (obj, prop) {