Kocal-Web-Extensions/Solary

View on GitHub
src/entities/Channel.ts

Summary

Maintainability
A
0 mins
Test Coverage
import Stream from './Stream';

export default class Channel {
  public online: boolean | null;

  public stream: Stream | null;

  constructor(public id: number, public username: string, public nickname: string, public networks: Solary.Networks) {
    this.online = null;
    this.stream = null;
  }

  url(): string {
    return `https://twitch.tv/${this.username}`;
  }

  markAsOnline(stream: Stream): void {
    this.online = true;
    this.stream = stream;
  }

  markAsOffline(): void {
    this.online = false;
    this.stream = null;
  }
}