Fix incorrect enum declaration (#25300)

This commit is contained in:
Moritz Gunz
2018-04-27 00:06:33 +02:00
committed by Wesley Wigham
parent c2b2901115
commit 014cf5df60
2 changed files with 7 additions and 7 deletions

View File

@@ -64,7 +64,12 @@ declare namespace Spotify {
duration: number;
paused: boolean;
position: number;
repeat_mode: RepeatMode;
/**
* 0: NO_REPEAT
* 1: ONCE_REPEAT
* 2: FULL_REPEAT
*/
repeat_mode: 0 | 1 | 2;
shuffle: boolean;
restrictions: PlaybackRestrictions;
track_window: PlaybackTrackWindow;
@@ -82,12 +87,6 @@ declare namespace Spotify {
volume?: number;
}
enum RepeatMode {
NO_REPEAT = 0,
ONCE_REPEAT = 1,
FULL_REPEAT = 2,
}
type ErrorListener = (err: Error) => void;
type PlaybackInstanceListener = (inst: WebPlaybackInstance) => void;
type PlaybackStateListener = (s: PlaybackState) => void;

View File

@@ -27,6 +27,7 @@ player.addListener("ready", (data) => {
player.getCurrentState().then((playbackState: Spotify.PlaybackState | null) => {
if (playbackState) {
const { current_track, next_tracks } = playbackState.track_window;
const repeatMode: 0 | 1 | 2 = playbackState.repeat_mode;
console.log("Currently Playing", current_track);
console.log("Playing Next", next_tracks[0]);