Get started with rsvp CDN

MIT licensed

RSVP: library for simplified asynchronous data flows, event handling in reactive programming.

Tags:
  • promises
  • futures

Stable version

Copied!

How to start using rsvp CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with rsvp CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/rsvp/4.8.5/rsvp.min.js"></script>
</head>
<body>
  <button id="loadData">Load Data</button>
  <script>
    const loadDataButton = document.getElementById('loadData');

    RSVP.config({
      concurrency: 1, // limit the number of concurrent requests
    });

    loadDataButton.addEventListener('click', () => {
      Promise.all([
        RSVP.get('https://api.example.com/data1'),
        RSVP.get('https://api.example.com/data2'),
      ])
        .then((responses) => {
          const data1 = responses[0].json();
          const data2 = responses[1].json();

          // process the data here
          console.log('Data 1:', data1);
          console.log('Data 2:', data2);
        })
        .catch((error) => {
          console.error('Error:', error);
        });
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions