@task encapsulatedTask = {
*perform(value) {
console.log('encapsulated waiting for 5 seconds');
yield timeout(5000);
console.log('encapsulated all done waiting');
return 'all good';
}
}
@task
*printEncapsulatedTaskValue() {
this.encapsulatedTask.perform();
let value = yield waitForProperty(this.encapsulatedTask, 'last.value');
console.log('encapsulated value: ', value);
}
In the code above ☝️ the encapsulated value is never printed to the console. We do however see the logs to indicate that the encapsulatedTask ran fine.
However for a normal task like:
@task
*normalTask() {
console.log('normal: waiting for 5 seconds');
yield timeout(5000);
console.log('normal: all done waiting');
return 'all good';
}
@task
*printNormalTaskValue() {
this.normalTask.perform();
let value = yield waitForProperty(this.normalTask, 'last.value');
console.log('normal value: ', value);
}
The waitForProperty resolves just fine and we get to see normal value: all good on the console.
I've created a dummy project to demo this: https://github.com/colenso/concurrency-test
In the code above ☝️ the encapsulated value is never printed to the console. We do however see the logs to indicate that the encapsulatedTask ran fine.
However for a normal task like:
The
waitForProperty
resolves just fine and we get to seenormal value: all good
on the console.