nodebox / seed

Procedural Content Generator
https://seed.emrg.be/
MIT License
22 stars 8 forks source link

Execute asynchronous JavaScript in a tag #18

Closed fdb closed 6 years ago

fdb commented 6 years ago

Currently the JS filter doesn't work with asynchronous JavaScript, returning a Promise object. It would be cool if we could use something like

js("await (await fetch('https://somewebservice.com/api.json")).json()")

and e.g. get the image URL back from a JSON request to Flickr.

kunal-mohta commented 6 years ago

So the user can have content from any web service by making requests directly from here?

stebanos commented 6 years ago

I created a branch asyncjsfilter. It works with this twitter example, but the first time it loads the timeout will kick in before the data has fully loaded!

kunal-mohta commented 6 years ago

Okay, I will have a look on it.

fdb commented 6 years ago

@stebanos That's because the Heroku app is sleeping... 💤