Get started with asynquence-contrib CDN

MIT licensed

Asynquence-contrib is a Python library providing additional features for the asynquence asyncio framework.

Tags:
  • async
  • flow-control
  • sequences
  • promise
  • iterator
  • generator

Stable version

Copied!

How to start using asynquence-contrib CDN


// Include the asynquence-contrib library from the CDN
const { sequence, waterfall, parallel, series } = require('https://cdn.cdnhub.io/asynquence-contrib/0.28.2/contrib.js');

// Define some asynchronous functions
const fetchData = (url) => new Promise((resolve) => {
  setTimeout(() => {
    resolve({ data: `Data from ${url}` });
  }, 1000);
});

const processData = (data) => new Promise((resolve) => {
  setTimeout(() => {
    const processedData = data.data.toUpperCase();
    resolve(processedData);
  }, 500);
});

// Use sequence to execute functions in a sequence
const sequenceExample = () => sequence(
  () => fetchData('https://example.com'),
  (data) => processData(data)
).then((processedData) => console.log(processedData));

// Call the sequenceExample function
sequenceExample();
Copied!
Copied!
Copied!
Copied!
Copied!

All versions