05-06-2020 10:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

Base Runner
40
3
19
05-06-2020 10:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Actually, the way to read the inbox queue of file names is by manually looping over `inbox.nextFile()` until it returns nothing.
That's already solved with iterables.
You can evolve that API to expose something like this:
const inboxFiles = {
next: () => {
const value = inbox.nextFile();
return {
value: value as string,
done: !value,
};
},
[Symbol.iterator]: function () {
return this;
},
};
So we can do stuff like
for (const fileName of inboxFiles) {
doStuff(fileName);
}
compared to:
let fileName = inbox.nextFile();
while (fileName) {
doStuff(fileName);
fileName = inbox.nextFile(fileName);
}
0 REPLIES 0
