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 ground = Dataspace._currentFacet.actor.dataspace.container;
let active = true; let active = true;
ground.backgroundTaskCount++; ground.backgroundTaskCount++;
return k(() => { function finish() {
if (active) { if (active) {
ground.backgroundTaskCount--; ground.backgroundTaskCount--;
active = false; active = false;
} }
}); }
return k ? k(finish) : finish;
}; };
Dataspace.referenceField = function (obj, prop) { Dataspace.referenceField = function (obj, prop) {