Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 543 Bytes

README.MD

File metadata and controls

37 lines (27 loc) · 543 Bytes

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