/every

Small library to handle recurring calls

Primary LanguageJavaScriptMIT LicenseMIT

Every.js

Call function every second

const {call} = require('every')

function sayHello() {
    console.log('Hi')
}

call(sayHello).every(1000)

Call function immediately and every second

const {call} = require('every')

function sayHello() {
    console.log('Hi')
}

call(sayHello).now().and().every(1000)

Call function, wait 1 second and run it again

const {sleep} = require('every')

async function main() {
    sayHello()
    await sleep(1000)
    sayHello()
}

main()