Giter Club home page Giter Club logo

char-spinner's Introduction

char-spinner

Put a little spinner on process.stderr, as unobtrusively as possible.

USAGE

var spinner = require("char-spinner")

// All options are optional
// even the options argument itself is optional
var interval = spinner(options)

// the return value is the interval.
// to stop the spinner, you can just clearInterval on it
clearInterval(interval)

// then to restart it again, just call the function again
interval = spinner(options)

OPTIONS

Usually the defaults are what you want. Mostly they're just configurable for testing purposes.

  • stream Output stream. Default=process.stderr
  • tty Only show spinner if output stream has a truish .isTTY. Default=true
  • string String of chars to spin. Default='/-\\|'
  • interval Number of ms between frames, bigger = slower. Default=50
  • cleanup Print '\r \r' to stream on process exit. Default=true
  • unref Unreference the spinner interval so that the process can exit normally. Default=true
  • delay Number of frames to "skip over" before printing the spinner. Useful if you want to avoid showing the spinner for very fast actions. Default=2

Returns the generated interval, if one was created.

char-spinner's People

Contributors

isaacs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

char-spinner's Issues

npm install fails

$ npm i
npm http GET https://registry.npmjs.org/tap
npm http 304 https://registry.npmjs.org/tap
npm ERR! notarget No compatible version found: tap@'>=0.4.10-0 <0.5.0-0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9","0.0.10","0.0.11","0.0.12","0.0.13","0.0.14","0.1.0","0.1.1","0.1.2","0.1.3","0.1.4","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.2.5","0.2.6","0.3.0","0.3.1","0.3.2","0.3.3","0.4.0","0.4.1","0.4.2","0.4.3","0.4.4","0.4.5","0.4.6","0.4.7","0.4.8","0.4.9"]
npm ERR! notarget 
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "i"
npm ERR! cwd /Users/maxogden/src/js/char-spinner
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.10
npm ERR! code ETARGET
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/maxogden/src/js/char-spinner/npm-debug.log
npm ERR! not ok code 0

Could be smoother / less jerky

When setInterval isn't able to fire at a steady rate the spinner animation is jerky. This can create a negative impression about the performance of what's actually happening while the spinner is running.

This can be see when using npm to install significantly large packages.

I'm not sure the best way to fix this.

Maybe a slower default rate?

Or a different animation that had more gradual steps which would be skipped when setInterval fired later than expected.

Or maybe we just need tty.requestAnimationFrame in Node. ๐Ÿ˜ธ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.