@boost/core
Version:
Robust pipeline for creating dev tools that separate logic into routines and tasks.
74 lines • 2.12 kB
TypeScript
import Console from './Console';
export declare type StringRenderer = () => string;
export interface OutputState {
completed: boolean;
concurrent: boolean;
final: boolean;
first: boolean;
}
export default class Output<Renderer extends () => any = StringRenderer> {
protected console: Console;
protected previousHeight: number;
protected renderer: Renderer;
protected state: OutputState;
constructor(cli: Console, renderer: Renderer);
/**
* Mark the output as concurrent to be rendered at the same time as other output.
*/
concurrent(): this;
/**
* Enqueue a render. Optionally mark the update as the final render.
*/
enqueue(final?: boolean): this;
/**
* Erase the previous content if it exists.
*/
erasePrevious(): this;
/**
* Return true if the output is complete and fully rendered.
*/
isComplete(): boolean;
/**
* Return true if the output should be rendered concurrently.
*/
isConcurrent(): boolean;
/**
* Return true if the next render is the final render.
*/
isFinal(): boolean;
/**
* Render the content to the console and calculate a new height.
* Since an output represents an exact line, or a collection of lines,
* we must always end with a new line to calculate height correctly.
*/
render(): this;
/**
* Mark the output as complete.
*/
protected markComplete(): void;
/**
* Mark as the final render.
*/
protected markFinal(): void;
/**
* Callback fired when output is completed.
*/
protected onComplete(): void;
/**
* Callback fired before the first render.
*/
protected onFirst(): void;
/**
* Callback fired before the last render.
*/
protected onLast(): void;
/**
* Callback fired when the output has been enqueued.
*/
protected onStart(): void;
/**
* Convert the renderer output to a string for the console.
*/
protected toString(output: ReturnType<Renderer>): string;
}
//# sourceMappingURL=Output.d.ts.map