@rustle/queue
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Queue

NPM version

Simple queue manipulation tool.

Demo

import { Queue } from '@rustle/queue';

const q = new Queue();

q.add((next) => {
  console.log(1);
  setTimeout(() => {
    next();
  })
})

q.add((next) => {
  console.log(2);
})

// Wait for the current queue to finish executing
q.awaitFinish().then(() => {
  console.log(4);

  // Restart
  q.add((next) => {
    console.log(1);
    next();
  })
})

CDN

<!DOCTYPE html>
<html lang="en">
<body>
  <script src="https://unpkg.com/@rustle/queue/dist/queue.umd.js"></script>
  <script>
    const { Queue } = window.SQ;
    const q = new Queue();

    // ...
  </script>
</body>
</html>

/@rustle/queue/

    Package Sidebar

    Install

    npm i @rustle/queue

    Weekly Downloads

    5

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    6.11 kB

    Total Files

    7

    Last publish

    Collaborators

    • rustle