its-thinking
v0.0.4
Published
Spinner for Node Terminal Applications
Downloads
59
Readme
Its Thinking
Spinner module for Node terminal applications
Fork of wemakeweb/node-spinner, a port of visionmedia/go-spin to node. Also, heavily influenced by helloIAmPau/node-spinner
Installation
1. Install via package manager
$ npm install its-thinking
2. Include in code
var ItsThinking = require("its-thinking");
Examples
See examples directory for more.
Basic Usage
var basicSpinner = new ItsThinking();
basicSpinner.start("Thinkin' 'bout numbers... ");
//And when you're done...
basicSpinner.stop();
Interval
By default, the pattern updates every 250 milliseconds, but that can change by passing a second argument to start.
var longSpinner = new ItsThinking();
longSpinner.start("Thinkin' long and hard 'bout numbers... ", 2000);
Patterns
Uses one of the built-in patterns by passing in an index (0 - 16)
var arrowSpinner = new ItsThinking(16);
arrowSpinner.start("Thinkin' 'bout arrows... ");
...or provide a custom string
var vowelSpinner = new ItsThinking("aeiou");
vowelSpinner.start("Thinkin' 'bout vowels... ");
...or a custom array.
var moreVowelSpinner = new ItsThinking(["a","e","i","o","u","sometimes y"]);
moreVowelSpinner.start("Thinkin' 'bout other vowels... ");
Access built-in patterns directly.
var trippyPattern = ItsThinking.Patterns[11].split("").map(function(item){return "[~> " + item + " <~]"});
var trippySpinner = new ItsThinking(trippyPattern);
trippySpinner.start("Thinkin' 'bout...");
License
MIT