Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yukimemi/nips
Spinner library for Deno
https://github.com/yukimemi/nips
deno spinner
Last synced: about 1 month ago
JSON representation
Spinner library for Deno
- Host: GitHub
- URL: https://github.com/yukimemi/nips
- Owner: yukimemi
- Created: 2022-09-19T12:23:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-24T00:39:40.000Z (over 2 years ago)
- Last Synced: 2024-11-16T13:47:03.699Z (2 months ago)
- Topics: deno, spinner
- Language: TypeScript
- Homepage: https://deno.land/x/nips
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nips
Spinner library for Deno## Demo
```sh
deno run -A https://deno.land/x/nips/example.ts
```## Example
```typescript
import { delay } from "https://deno.land/[email protected]/async/delay.ts";
import * as colors from "https://deno.land/[email protected]/fmt/colors.ts";
import { Nip, Nips } from "https://deno.land/x/nips/mod.ts";const dots = new Nip(
["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map(colors.cyan),
["✔"].map(colors.green),
["✘"].map(colors.red),
);const arc = new Nip(
["◜", "◠", "◝", "◞", "◡", "◟"].map(colors.magenta),
["○"].map(colors.green),
["×"].map(colors.red),
);const arrow = new Nip(
["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"].map(colors.yellow),
["○", "◎", "●"].map(colors.green),
["×", "✘", "✖"].map(colors.red),
);const nips = new Nips({
interval: 70,
n: { dots, arc, arrow },
});nips.start("${this.n.dots.spin()} start spin ...");
await delay(2000);
nips.stop("${this.n.dots.spin()} stop spin ...");
await delay(2000);
const variableText = "This is variable text";
nips.start(`\${this.n.dots.spin()} ${variableText}`);
await delay(2000);
nips.start("${this.n.dots.fail()} fail spin !");
await delay(2000);
nips.start("${this.n.dots.spin()} restart spin ...");
await delay(2000);
nips.start(
"${this.n.dots.spin()} 1st spin ...\n${this.n.arc.spin()} 2nd spin ...",
);
await delay(2000);
nips.start(
"${this.n.dots.spin()} 1st spin ...\n${this.n.arc.spin()} 2nd spin ...\n${this.n.arrow.spin()} 3rd spin ...",
);
await delay(2000);
nips.stop(
"${this.n.dots.success()} 1st spin success !\n${this.n.arc.fail()} 2nd spin fail ...\n${this.n.arrow.spin()} 3rd spin ...",
);
await delay(2000);
nips.clear(2);
nips.start(
"${this.n.arc.spin()} 2nd spin restart !\n${this.n.arrow.spin()} 3rd spin restart !",
);
await delay(2000);
nips.start(
"${this.n.arc.spin()} 2nd spin ...\n${this.n.arrow.spin()} 3rd spin ...",
);
await delay(2000);
nips.start(
"${this.n.arc.success()} 2nd spin success !\n${this.n.arrow.success()} 3rd spin success (not stop)!",
);
await delay(2000);
nips.stop(
"${this.n.arc.success()} 2nd spin success !\n${this.n.arrow.success()} 3rd spin success !\n",
);
nips.stop("${this.n.dots.success()} ALL SUCCESS !\n");
```