Skip to content
This repository has been archived by the owner. It is now read-only.

Mist does not support JavaScript async functions #2620

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

Mist does not support JavaScript async functions #2620

interfect opened this issue Jun 24, 2017 · 3 comments
Labels

Comments

@interfect
Copy link

@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
Copy link

@JesseBusman JesseBusman commented Sep 28, 2017

I believe this is fixed in Mist 0.9.1

@evertonfraga
Copy link
Member

@evertonfraga 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
Copy link

@lock 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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.