Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
myTask: task(function * () {
this.set('value', "START");
let ai = asyncIterator.fromEvent(this, 'onEvent');
if (this.bufferType) {
ai[this.bufferType]();
}
while (true) {
let { value, done } = yield ai.next();
if (done) { break; }
this.set('value', value.foo);
yield sleep(800); // pretend to be some async work
}
}).autoStart(),