0.0.4 • Published 2 years ago

just-a-loop v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Just a Loop 🔁

Just a Loop lets your making loops with intervals and timeouts easier in JavaScript.

Usage for Intervals 🎈

import { interval } from "just-a-loop"

interval(({ index }) => {
    console.log(index)
}, { delayMs: 50, end: 10 })

The same with setInterval

let index = 0
const interval = setInterval(() => {
    if (index >= 10) clearInterval(interval)
    console.log(index)
    index++
}, 50)

Usage for Timeouts 🎈

import { timeout } from "just-a-loop"

timeout(() => console.log("Hi"), { delayMs: 50 })

The same with setTimeout

const timeout = setTimeout(() => console.log("Hi"), 50)
0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago