Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 725 Bytes

README.md

File metadata and controls

41 lines (30 loc) · 725 Bytes

countdown

The time countdown tool provides a countdown queue function, avoids opening multiple timers, and supports clearing a single countdown task. More efficient countdown.

Install

npm install @oasis-cloud/countdown

Demo

  • Add countdown task
import countdown from '@oasis-cloud/countdown'

const [clearCountdown, addCountdown] = countdown()

const taskName = 'skill'

const taskParams = {
    remaining: 1000,
    unit: 'sec'
}

const task = (remaining) => {
    // do something
    console.log(remaining)
}
addCountdown(taskName, taskParams, task)
  • Clear countdown
// Only clears skill tasks
clearCountdown('skill')
// clear all tasks
clearCountdown()