Created
March 19, 2016 20:21
-
-
Save JeremyLikness/e402370ae7a57a03723c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {EventEmitter} from 'angular2/core'; | |
import {IConsoleService} from './interfaces'; | |
import {Constants} from '../globalConstants'; | |
export class ConsoleService implements IConsoleService { | |
public lines: string[]; | |
public logEvent: EventEmitter<string> = new EventEmitter<string>(); | |
constructor() { | |
this.lines = []; | |
} | |
public log(message: string): void { | |
this.lines.push(message); | |
if (this.lines.length > Constants.Display.ConsoleLines) { | |
this.lines.splice(0, 1); | |
} | |
this.logEvent.emit(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment