Code Monkey home page Code Monkey logo

Comments (1)

yortus avatar yortus commented on July 1, 2024

Hi @GarouDan,

asyncawait (i.e. this library) is strictly node-only because it relies on the native node module node-fibers.

As you probably know, async/await (not linked to this library except by common inspiration/origins) is now a stage-3 proposal for integration into the JavaScript language itself, but it still has little current browser support (MS Edge supports it).

To use async/await in browsers today, your best bet is probably to use Babel to transpile your code to equivalent ES5. Async functions get transpiled into equivalent code that uses ES5 generators, which most browsers do support. I believe there is even a way to transpile to equivalent ES3 although the transformation is complex and you will no longer recognise your source code, but it should run in all browsers.

I'm not sure if Babel can help with script blocks embedded in a html file like your example above. It would be best to separate the JavaScript into its own file(s).

Closing as there is nothing actionable for asyncawait here, but feel free to comment/reopen if you have more questions.

from asyncawait.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.