n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

Support top-level await #173

Open Masterxilo opened 5 years ago

Masterxilo commented 5 years ago
x = await 1

should just work, like it does in the chrome dev console and node --experimental-repl-await.

For interactive use especially, this is much more convenient.

const result = await fetch("http://google.com")

versus

var result
fetch("http://google.com").then(x => result = x)
n-riesco commented 5 years ago

This is still an experimental feature, if you want to test it, please use ijavascript-await.

geosp commented 3 years ago

You can also do this:

(async () => {
 const request = require('async-request')
 let result = await request("http://google.com")
 console.log({result})
})()
ezyang commented 2 years ago

Is this still experimental or does it work in regular ijavascript now? I see ijavascript-await hasn't been updated for three years.

ezyang commented 2 years ago

Judging from https://github.com/n-riesco/ijavascript/compare/await?expand=1 looks like it's not merged

ezyang commented 2 years ago

People on this thread may be interested in https://github.com/n-riesco/ijavascript/pull/257

n-riesco commented 2 years ago

Good news! Node.js v16.6+ (released at the end of July) finally supports top level await out of the box.

There is no need for ijavascript-await and I'll deprecate it now.

n-riesco commented 2 years ago

:disappointed: I jumped the gun. When I wrote my previous message, I was testing directly on Node.js CLI. Unfortunately, ijavascript is affected by https://github.com/nodejs/node/issues/40898 .

I've undeprecated ijavascript-await and I'll publish a new releases including the updates in the latest ijavascript soon.

brandonmpetty commented 1 year ago

What is the status on await support?

n-riesco commented 1 year ago

I haven't looked into supporting await recently, but judging by https://github.com/nodejs/node/issues/45924 , I don't think it is.

I suppose ijavascript-await is still working (as I haven't had anyone opening issues for it).

sohang3112 commented 9 months ago

I suppose ijavascript-await is still working (as I haven't had anyone opening issues for it).

@n-riesco I ran into this issue while installing kernel of ijavascript-await - please have a look.