Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iov-cli] Add wait() function to repl #181

Merged
merged 2 commits into from Jul 20, 2018
Merged

[iov-cli] Add wait() function to repl #181

merged 2 commits into from Jul 20, 2018

Conversation

webmaster128
Copy link
Contributor

Create wait() as an alternative to the await keyword, that does not work with TypeScript in a repl.

We use deasync2 via Github because of bluelovers/deasync#1 and disable node warnings because of bluelovers/deasync#2.

Copy link
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice. Thank you for the wait(). The readme reads much nicer.

// yarn run ts-node wait-demo.ts

function wait<T>(promise: Promise<T>): T {
return require('deasync2').await(promise);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to do the require/import once at the top of the file and then just use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using it like this such that I can easily convert it into a single line command for the init file.

@ethanfrey ethanfrey merged commit 829bcb4 into master Jul 20, 2018
@ethanfrey ethanfrey deleted the wait branch July 20, 2018 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants