Get started with async CDN

MIT licensed

Async library: Writes non-blocking I/O code with callbacks or Promises.

Tags:
  • async
  • callback
  • utility
  • module

Stable version

Copied!

How to start using async CDN


<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.cdnhub.io/async/3.2.5/async.min.js"></script>
  <script>
    async function fetchData() {
      const promise1 = fetch('https://jsonplaceholder.typicode.com/todos/1');
      const promise2 = fetch('https://jsonplaceholder.typicode.com/todos/2');

      const [data1, data2] = await Promise.all([promise1, promise2]);

      return { data1, data2 };
    }

    fetchData()
      .then(result => {
        console.log('Fetched data:', result);
      })
      .catch(error => {
        console.error('Error:', error);
      });
  </script>
</head>
<body>
</body>
</html>
Copied!
Copied!

All versions