23 lines
585 B
TypeScript
23 lines
585 B
TypeScript
import { DisplayPrinter } from './interface';
|
|
import { ConsolePrinter } from './console';
|
|
import { OledPrinter } from './oled';
|
|
|
|
export class Display {
|
|
private _display: DisplayPrinter;
|
|
|
|
constructor(useConsole: boolean) {
|
|
this._display = useConsole
|
|
? new ConsolePrinter()
|
|
: new OledPrinter();
|
|
}
|
|
|
|
public async displayContent(content: string, wrap: boolean = true): Promise<void> {
|
|
this._display.clear(false);
|
|
await this._display.displayContent(content, wrap);
|
|
}
|
|
|
|
public clear(turnOff: boolean = false): void {
|
|
this._display.clear(turnOff);
|
|
}
|
|
}
|