Get started with asynquence CDN

MIT licensed

Asynquence is a library for managing asynchronous workflows using a chainable, fluent interface.

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

Stable version

Copied!

How to start using asynquence CDN


// Include Asynquence library from the CDN
const Asynquence = require('asq').import('asq');

// Create a sequence with three tasks
const sequence = Asynquence()
  .delay(1000) // Delay for 1 second
  .map(function(value) {
    return value + 1;
  })
  .delay(1000) // Delay for 1 second
  .map(function(value) {
    return value * 2;
  })
  .map(function(value) {
    console.log('Result:', value); // Log the result
    return Asynquence.all([Asynquence.promise(function() {
      return new Promise(function(resolve) {
        setTimeout(function() {
          resolve();
        }, 2000); // Delay for 2 seconds
      });
    })]);
  })
  .then(function() {
    console.log('Sequence completed.');
  });

// Start the sequence
sequence.run();
Copied!
Copied!

All versions