Skip to content

Instantly share code, notes, and snippets.

@stenno
Created February 11, 2019 23:09
Show Gist options
  • Save stenno/e09c2b37fb15244fcf11256c5f910079 to your computer and use it in GitHub Desktop.
Save stenno/e09c2b37fb15244fcf11256c5f910079 to your computer and use it in GitHub Desktop.
async generator example
async doANSIInput(data) {
this.session.prepareForInput();
const terminal = await this.session.rawInput(data, WAITING_DELAY);
const ANSIWindow = terminal.getANSICells();
return ANSIWindow;
}
async* batchANSIInput(commands) {
for (const data of commands) {
yield await this.doANSIInput(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment