Compare commits

...

3 Commits

Author SHA1 Message Date
Thomas Viesmose Birch
5211a4a976 Adding songtype to playlists 2024-05-04 17:31:58 +02:00
Thomas Viesmose Birch
58f972156e Typescript is hard! 2024-05-04 16:20:19 +02:00
Thomas Viesmose Birch
1f69d0e867 Added OthersPlaylists to the parseMessages 2024-05-04 16:19:16 +02:00
5 changed files with 13 additions and 8 deletions

View File

@ -23,10 +23,11 @@ export class PlayingSong extends QueuedSong {
}
export class Playlist {
constructor(public title: string, public listener: string, public songs: Song[]) {
constructor(public title: string, public listener: string, public type: SongType, public songs: Song[]) {
}
}
export class PlaylistDescription {
constructor(public title: string, public listener: string) {
constructor(public title: string, public listener: string, public type: SongType) {
}
}

6
dist/dataTypes.d.ts vendored
View File

@ -25,11 +25,13 @@ export declare class PlayingSong extends QueuedSong {
export declare class Playlist {
title: string;
listener: string;
type: SongType;
songs: Song[];
constructor(title: string, listener: string, songs: Song[]);
constructor(title: string, listener: string, type: SongType, songs: Song[]);
}
export declare class PlaylistDescription {
title: string;
listener: string;
constructor(title: string, listener: string);
type: SongType;
constructor(title: string, listener: string, type: SongType);
}

6
dist/dataTypes.js vendored
View File

@ -57,18 +57,20 @@ var PlayingSong = /** @class */ (function (_super) {
}(QueuedSong));
exports.PlayingSong = PlayingSong;
var Playlist = /** @class */ (function () {
function Playlist(title, listener, songs) {
function Playlist(title, listener, type, songs) {
this.title = title;
this.listener = listener;
this.type = type;
this.songs = songs;
}
return Playlist;
}());
exports.Playlist = Playlist;
var PlaylistDescription = /** @class */ (function () {
function PlaylistDescription(title, listener) {
function PlaylistDescription(title, listener, type) {
this.title = title;
this.listener = listener;
this.type = type;
}
return PlaylistDescription;
}());

View File

@ -50,7 +50,7 @@ function parseMessage(message) {
case 'GetOtherPlaylists':
return new messageTypes_1.GetOtherPlaylists();
case 'OthersPlaylists':
return new messageTypes_1.OthersPlaylists(data.playlist);
return new messageTypes_1.OthersPlaylists(data.playlists);
case 'ToggleTag':
return new messageTypes_1.ToggleTag(data.song, data.tag);
case 'Shuffle':

View File

@ -73,7 +73,7 @@ export default function parseMessage(message: string): StuenMessage | null {
case 'GetOtherPlaylists':
return new GetOtherPlaylists();
case 'OthersPlaylists':
return new OthersPlaylists(data.playlist);
return new OthersPlaylists(data.playlists);
case 'ToggleTag':
return new ToggleTag(data.song, data.tag);
case 'Shuffle':