mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
[spotify-web-playback-sdk] Extend Image interface with width and height properties (#40120)
* [spotify-web-playback-sdk] Extend Image interface with width and height properties * [spotify-web-playback-sdk] Extend Image interface with width and height properties, implement review suggestion
This commit is contained in:
committed by
Nathan Shively-Sanders
parent
408c37f3e3
commit
57a96850d4
+3
@@ -4,6 +4,7 @@
|
||||
// Marcus Weiner <https://github.com/mraerino>
|
||||
// Moritz Gunz <https://github.com/NeoLegends>
|
||||
// Daniel Almaguer <https://github.com/deini>
|
||||
// Hanna Becker <https://github.com/hanna-becker>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
@@ -33,7 +34,9 @@ declare namespace Spotify {
|
||||
type ErrorTypes = 'account_error' | 'authentication_error' | 'initialization_error' | 'playback_error';
|
||||
|
||||
interface Image {
|
||||
height?: number | null;
|
||||
url: string;
|
||||
width?: number | null;
|
||||
}
|
||||
|
||||
interface PlaybackContext {
|
||||
|
||||
@@ -32,6 +32,10 @@ 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;
|
||||
const images = current_track.album.images;
|
||||
if (images.length) {
|
||||
const { 0: { height, width } } = images;
|
||||
}
|
||||
|
||||
console.log("Currently Playing", current_track);
|
||||
console.log("Playing Next", next_tracks[0]);
|
||||
|
||||
Reference in New Issue
Block a user