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

Mist does not support JavaScript async functions #2620

Closed
interfect opened this Issue Jun 24, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@interfect

interfect commented Jun 24, 2017

Version: `0.8.10`
OS & Version: Windows 7
Node type: `geth`
Number of blocks synchronized: 3925000

Try browsing a dapp that uses JavaScript that looks like this:

async function () {
}

Mist does not parse it correctly, and produces an Uncaught SyntaxError: Unexpected token function message.

Presumably Mist does not yet support this ES7 feature. But nearly everyone else does, and Chrome in particular has been shipping support since January, so in this respect Mist is behind competing solutions like Metamask.

async and await make working with Promises practical, because you can just do a let value = await somePromiseReturningFunction() instead of cramming your code inside an endless chain of anonymous .then() arguments. It is very important to have these available, especially when working with Promise-based dapp frameworks like Truffle. They can be simulated to an extent by implementing them in a script-rewriting build system, of which there are many, but using one necessitates adding a build step to one's development workflow.

Mist should be updated to a modern version of Electron that supports async/await. It looks like right now Mist is on the relatively old Electron 1.3.13, from Dec 6, 2016. Mist should upgrade to the current Electron, 1.6.11.

@JesseBusman

This comment has been minimized.

Show comment
Hide comment
@JesseBusman

JesseBusman Sep 28, 2017

I believe this is fixed in Mist 0.9.1

JesseBusman commented Sep 28, 2017

I believe this is fixed in Mist 0.9.1

@evertonfraga

This comment has been minimized.

Show comment
Hide comment
@evertonfraga

evertonfraga Sep 28, 2017

Member

It is indeed @JesseBusman. We've updated to Electron 1.7.8, which has a more up to date Chromium engine behind.

And you can try for yourself:

// wait ms milliseconds
function wait(ms) {
  return new Promise(r => setTimeout(r, ms));
}

async function hello() {
  await wait(500);
  return 'world';
}

hello().then((e) => console.log(e))

(https://developers.google.com/web/fundamentals/primers/async-functions)

Member

evertonfraga commented Sep 28, 2017

It is indeed @JesseBusman. We've updated to Electron 1.7.8, which has a more up to date Chromium engine behind.

And you can try for yourself:

// wait ms milliseconds
function wait(ms) {
  return new Promise(r => setTimeout(r, ms));
}

async function hello() {
  await wait(500);
  return 'world';
}

hello().then((e) => console.log(e))

(https://developers.google.com/web/fundamentals/primers/async-functions)

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot Mar 30, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

lock bot commented Mar 30, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked and limited conversation to collaborators Mar 30, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.