转载

loading-cli:命令行中loading效果

loading-cli

Terminal loading effect.

loading-cli:命令行中loading效果

Install

$ npm install --save loading-cli

Usage

var loading =  require('loading-cli'); var load = loading("loading text!!")  load.start()  setTimeout(function(){     load.color = 'yellow';     load.text = ' Loading rainbows'; },2000)  // stop setTimeout(function(){     load.stop() },3000)

API

loading([options|text])

options

load({     "text":"loading text!!",     "color":"yellow",     "interval":100,     "stream": process.stdout,     "frames":["", "", "", ""] })

text

Type: string Text to display after the spinner.

loading("loading text!!")

color

Values: black red green yellow blue magenta cyan white gray

frames

["", "", "", ""] ["", "", "", ""] [".", "o", "O", "°", "O", "o", "."] ["", ""] ["", ""] ["", "", "", "", "", "", "", ""] [":clock1: ", ":clock2: ", ":clock3: ", ":clock4: ", ":clock5: ", ":clock6: ", ":clock7: ", ":clock8: ", ":clock9: ", ":clock10: ", ":clock11: "]

Instance

.start()

Start the spinner. Returns the instance.

.stop()

Stop and clear the spinner. Returns the instance.

.clear()

Clear the spinner. Returns the instance.

.render()

Manually render a new frame. Returns the instance.

.frame()

Get a new frame.

.text

Change the text.

.color

Change the spinner color.

原文  https://github.com/jaywcjlove/loading-cli
正文到此结束
Loading...