Skip to content

Commit

Permalink
fix: remove on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu4k committed Aug 30, 2020
1 parent 4782f43 commit e353b72
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion deps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * as colors from "https://deno.land/[email protected]/fmt/colors.ts";
export { encode, decode } from "https://deno.land/[email protected]/encoding/utf8.ts";
export * as tty from "https://deno.land/x/[email protected]/mod.ts";
export { onExit } from "https://deno.land/x/[email protected]/mod.ts";
12 changes: 12 additions & 0 deletions examples/history.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { wait } from "../mod.ts";

const spinner = wait("Loading mesozoic").start();

setTimeout(() => {
spinner.color = "yellow";
spinner.text = "Loading meteorite";
}, 1000);

setTimeout(() => {
spinner.succeed("Started human race");
}, 2000);
File renamed without changes.
4 changes: 0 additions & 4 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { colors, encode, tty } from "./deps.ts";
import spinners from "./spinners.ts";

import { symbols } from "./log_symbols.ts";
import { onExit } from "https://deno.land/x/[email protected]/mod.ts";

type ColorFunction = (message: string) => string;
const colormap: { [key: string]: ColorFunction } = {
Expand Down Expand Up @@ -157,9 +156,6 @@ export class Spinner {

if (this.#opts.hideCursor && Deno.build.os !== "windows") {
tty.hideCursorSync(this.#stream);
onExit(() => {
tty.showCursorSync(this.#stream);
});
}

this.render();
Expand Down

0 comments on commit e353b72

Please sign in to comment.