All files / games/screens/src observer.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  2x 2x     5x     3x     2x        
import { ObservableInterface, ObserverInterface } from "jga-patterns-observer";
 
import { ConsoleInterface } from "jga-games-console";
 
export class ScreenObserver implements ObserverInterface {
    private readonly console: ConsoleInterface;
 
    public constructor(console: ConsoleInterface) {
        this.console = console;
    }
 
    public update(subject: ObservableInterface, message: string): void {
        this.console.append(`[${subject.constructor.name}] ${message}`);
    }
}