Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
molvqingtai committed Apr 3, 2024
1 parent b04280e commit 209dcb8
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ import Timer from '@resreq/timer'

const log = (time: number) => console.log('time:', time)

const timer = new Timer(log, {
delay: 1000,
immediate: true
})

timer.on('start', (time) => {
console.log('start:', time)
})
timer.on('pause', (time) => {
console.log('pause:', time)
})
timer.on('stop', (time) => {
console.log('stop:', time)
})

timer.start()
setTimeout(() => timer.pause(), 1000)
setTimeout(() => timer.start(), 2000)
setTimeout(() => timer.stop(), 3000)
const timer = new Timer(log, {
delay: 1000,
immediate: true
})

timer.on('start', (time) => {
console.log('start:', time)
})
timer.on('pause', (time) => {
console.log('pause:', time)
})
timer.on('stop', (time) => {
console.log('stop:', time)
})

timer.start()

setTimeout(() => timer.pause(), 1000)
setTimeout(() => timer.start(), 2000)
setTimeout(() => timer.stop(), 3000)

// => start: 1712160512855
// => time: 1712160512858
// => pause: 1712160513855
Expand Down

0 comments on commit 209dcb8

Please sign in to comment.