1.4.6 • Published 10 months ago
@resreq/task v1.4.6
Task
⏰ Short and sweet task.
Install
npm install @resreq/taskUsage
import Task from '@resreq/task'
const log1 = (time: number) => console.log('log1:', time)
const log2 = (time: number) => console.log('log2:', time)
const log3 = (time: number) => console.log('log3:', time)
const task = new Task({
interval: 1000
})
task.push('id-1', log1)
task.push('id-2', log2)
task.push('id-3', log3)
task.start()
setTimeout(() => {
task.stop()
}, 3000)
// log1: 1733133501541
// log2: 1733133502541
// log3: 1733133503541Adapter
setTimeout is used by default, and custom adapters are supported, such as requestAnimationFrame, cancelIdleCallback, etc...
const task = new Task({
adapter: {
setTimer: globalThis.requestAnimationFrame.bind(globalThis),
cancelTimer: globalThis.cancelAnimationFrame.bind(globalThis)
}
})LICENSE
This project is licensed under the MIT License - see the LICENSE file for details.
1.4.6
10 months ago
1.4.5
12 months ago
1.4.4
1 year ago
1.4.3
1 year ago
1.4.2
1 year ago
1.4.1
1 year ago
1.4.0
1 year ago
1.3.4
1 year ago
1.3.3
1 year ago
1.3.2
1 year ago
1.3.1
1 year ago
1.3.0
1 year ago
1.2.1
1 year ago
1.2.0
1 year ago
1.1.3
1 year ago
1.1.2
1 year ago
1.1.1
1 year ago
1.1.0
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago