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
Type declaration:#
| Name | Type |
|---|---|
BgBlack | string |
BgBlue | string |
BgCyan | string |
BgGreen | string |
BgMagenta | string |
BgRed | string |
BgWhite | string |
BgYellow | string |
Blink | string |
Bright | string |
Dim | string |
FgBlack | string |
FgBlue | string |
FgCyan | string |
FgGreen | string |
FgMagenta | string |
FgRed | string |
FgWhite | string |
FgYellow | string |
Hidden | string |
Reset | string |
Reverse | string |
Underscore | string |
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:#
| Name | Type |
|---|---|
newOutput | unknown[] |
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
example
Parameters:#
| Name | Type | Default value | Description |
|---|---|---|---|
color | Reset | 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 |
message | unknown | - | The message to add |
afterColored | string | "" | 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
Returns: unknown[]
The output array
Defined in: output.ts:130
line#
â–¸ line(): void
Adds a line break to the output array
example
Returns: void
Defined in: output.ts:73
log#
â–¸ log<T>(value: T): T
Adds a message to the output array
example
Type parameters:#
| Name | Type |
|---|---|
T | unknown |
Parameters:#
| Name | Type | Description |
|---|---|---|
value | T | The message to add |
Returns: T
Defined in: output.ts:59
nested#
â–¸ nested(): Output
Adds a nested output instance to the output array
example
Returns: Output
The nested output
Defined in: output.ts:114