Movatterモバイル変換


[0]ホーム

URL:


top
Image To URI<sup>1.1.2</sup> logoImage To URI1.1.2

loading-cli

Buy me a coffeeCI

Terminal loading effect.

Install

$npminstall--save loading-cli

Usage

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

Custom text colorcolors-cli

const color=require('colors-cli/toxic');const loading=require('loading-cli');const load=loading("loading text!!".blue).start();// stopsetTimeout(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:blackredgreenyellowbluemagentacyanwhitegray

frames

["◰","◳","◲","◱"]["◐","◓","◑","◒"][".","o","O","°","O","o","."]["⊶","⊷"]["ဝ","၀"]["←","↖","↑","↗","→","↘","↓","↙"]["🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]

Instance

.start([text])

Start the spinner. Returns the instance.

.stop()

Stop and clear the spinner. Returns the instance.

.clear()

Clear the spinner. Returns the instance.

.succeed([text])

Stop the spinner, change it to a green and persist the current text, or text if provided. Returns the instance. See the GIF below.

.fail([text])

Stop the spinner, change it to a red and persist the current text, or text if provided. Returns the instance. See the GIF below.

.warn([text])

Stop the spinner, change it to a yellow and persist the current text, or text if provided. Returns the instance.

.info([text])

Stop the spinner, change it to a blue and persist the current text, or text if provided. Returns the instance.

.render()

Manually render a new frame. Returns the instance.

.frame()

Get a new frame.

const loading=require('loading-cli');const load=loading("loading text!!");load.frame(["◰","◳","◲","◱"]);load.start();

.text

Change the text.

.color

Change the spinner color.

Contributors

As always, thanks to our amazing contributors!

Made withcontributors.

License

Licensed under the MIT License.

Released under the MIT License. Copyright © 2024 Kenny Wong
Generated byidoc v1.27.2

[8]ページ先頭

©2009-2025 Movatter.jp