Class: Output#

Store and flush a series of outputs synchronously

Constructors#

constructor#

+ new Output(): Output

Returns: Output

Properties#

COLORS#

â–ª Readonly Static COLORS: object

ANSI Escape Sequences

example

const bold = Output.Colors.Bright;

Type declaration:#

NameType
BgBlackstring
BgBluestring
BgCyanstring
BgGreenstring
BgMagentastring
BgRedstring
BgWhitestring
BgYellowstring
Blinkstring
Brightstring
Dimstring
FgBlackstring
FgBluestring
FgCyanstring
FgGreenstring
FgMagentastring
FgRedstring
FgWhitestring
FgYellowstring
Hiddenstring
Resetstring
Reversestring
Underscorestring

Defined in: output.ts:23

Accessors#

output#

• get output(): unknown[]

All messages or nested outputs of this Output instance

Returns: unknown[]

Defined in: output.ts:36

• set output(newOutput: unknown[]): void

All messages or nested outputs of this Output instance

Parameters:#

NameType
newOutputunknown[]

Returns: void

Defined in: output.ts:45

Methods#

coloredLog#

â–¸ coloredLog(color: Reset | Bright | Dim | Underscore | Blink | Reverse | Hidden | FgBlack | FgRed | FgGreen | FgYellow | FgBlue | FgMagenta | FgCyan | FgWhite | BgBlack | BgRed | BgGreen | BgYellow | BgBlue | BgMagenta | BgCyan | BgWhite, message: unknown, afterColored?: string): string

Adds a colored message to the output array

example

new Output().coloredLog("BgBlue", "hi");

example

new Output().coloredLog("FgYellow", "hi", "this string will not be colored");

Parameters:#

NameTypeDefault valueDescription
colorReset | Bright | Dim | Underscore | Blink | Reverse | Hidden | FgBlack | FgRed | FgGreen | FgYellow | FgBlue | FgMagenta | FgCyan | FgWhite | BgBlack | BgRed | BgGreen | BgYellow | BgBlue | BgMagenta | BgCyan | BgWhite-The color to log in
messageunknown-The message to add
afterColoredstring""The optional message after the colored message (on the same line)

Returns: string

The colored log message

Defined in: output.ts:94


flush#

â–¸ flush(): unknown[]

Logs all messages in the output array

example

new Output().flush();

Returns: unknown[]

The output array

Defined in: output.ts:130


line#

â–¸ line(): void

Adds a line break to the output array

example

new Output().line();

Returns: void

Defined in: output.ts:73


log#

â–¸ log<T>(value: T): T

Adds a message to the output array

example

new Output().log("hi");

Type parameters:#

NameType
Tunknown

Parameters:#

NameTypeDescription
valueTThe message to add

Returns: T

Defined in: output.ts:59


nested#

â–¸ nested(): Output

Adds a nested output instance to the output array

example

const nested = new Output().nested();

Returns: Output

The nested output

Defined in: output.ts:114