linespin
Version:
Simple progress output
44 lines (32 loc) • 653 B
text/coffeescript
# linespin_example.coffee
Linespin = require '../linespin'
# Create new instance of linespin
linespin = new Linespin 'Spinning...', 'All done!', 100
# Start spinner at beginning of task
linespin.start()
# Error
setTimeout ->
linespin.error 'Error!'
, 1000
# Warning
setTimeout ->
linespin.warn 'Warning...'
, 3000
# Message
setTimeout ->
linespin.msg 'Hello World...'
, 3000
# Success
setTimeout ->
linespin.pending 'Pending...'
, 4000
# Success
setTimeout ->
linespin.success 'Success!'
, 5000
# Some long running task...
setTimeout ->
results = 42
# Stop at the end of task
linespin.stop "The answer is #{ results }"
, 6000