@fiveid/loopy
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Loopy

Nested Loops.

Example usage

With a single loop:

const loop = new Loopy({
  iterations: 5,
  delay: 500,
  onLoop(i) {
    // do something on each iteration
    alert("Loop number: " + i);
  },
  onLoopEnd() {
    // do something when the loop has completed
    alert("All done!");
  }
});

loop.start();

With multiple nested loops:

const loop = new Loopy([
  {
    iterations: 5,
    delay: 500,
    onLoop(i) {
      // Do something and then loop through sub-loops!
    },
    onLoopEnd() {
      // All finished!
    }
  },
  {
    iterations: 10,
    delay: 1000,
    onLoop(i) {
      // Do something
    },
    onLoopEnd() {
      // Sub-loop finished, resume looping through top loop!
    }
  }
]);

loop.start();

Readme

Keywords

none

Package Sidebar

Install

npm i @fiveid/loopy

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

5.32 kB

Total Files

6

Last publish

Collaborators

  • fiveid