0.0.1 • Published 5 years ago

@fiveid/loopy v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

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();
0.0.1

5 years ago