Skip to content

Instantly share code, notes, and snippets.

@JeremyLikness
Created March 19, 2016 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeremyLikness/e402370ae7a57a03723c to your computer and use it in GitHub Desktop.
Save JeremyLikness/e402370ae7a57a03723c to your computer and use it in GitHub Desktop.
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