Get started with chainloading CDN
BSD licensed
Chainloading: Passing function execution to next in JS. Chains multiple functions.
Tags:- deferred
- deferreds
- chain
- loading
Stable version
Copied!
How to start using chainloading CDN
// Include the library from the CDN
const Chain = window.ChainLoading.Promise;
// Create a promise that resolves after 2 seconds
const promise1 = new Promise(resolve => setTimeout(resolve, 2000));
// Create a promise that resolves after 3 seconds
const promise2 = new Promise(resolve => setTimeout(resolve, 3000));
// Chain promises using `Chain`
const chainedPromise = Chain(promise1)
.then(() => console.log('Promise 1 resolved'))
.then(() => promise2)
.then(() => console.log('Promise 2 resolved'))
.then(() => console.log('All promises resolved'));
// Start the chain
chainedPromise.start();
Copied!