Skip to content

Commit

Permalink
fix: isSpinning
Browse files Browse the repository at this point in the history
  • Loading branch information
usmanyunusov committed Dec 9, 2024
1 parent 6f5544c commit f5eb314
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ export function createSpinner(text = '', opts: Options = {}) {
},

start(opts = {}) {
spinning = true
timer && spinner.reset()
spinning = true
mountProcessEvents()
return spinner.update({ text: getText(opts), color: getColor(opts) }).loop()
},

stop(opts = {}) {
spinning = false

clearTimeout(timer)
cleanupProcessEvents()

Expand Down
8 changes: 4 additions & 4 deletions test/is-spinning.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ test('detects if spinner is spinning or not using other methods', () => {
spinner.success()
is(spinner.isSpinning(), false)

spinner.stop()
is(spinner.isSpinning(), false)

spinner.start()
spinner.clear()
is(spinner.isSpinning(), true)

spinner.stop()
is(spinner.isSpinning(), false)
})

test.run()
test.run()

0 comments on commit f5eb314

Please sign in to comment.