mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
Improve typing of onTrackDidChange
This commit is contained in:
parent
8ca8de7738
commit
96c65aaebb
2 changed files with 12 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ import { LoadedURLTrack } from "../../js/types";
|
|||
export default function enableMediaSession(webamp: WebampLazy) {
|
||||
if ("mediaSession" in navigator) {
|
||||
/* global MediaMetadata */
|
||||
webamp.onTrackDidChange((track: LoadedURLTrack | null) => {
|
||||
webamp.onTrackDidChange(track => {
|
||||
if (track == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
12
index.d.ts
vendored
12
index.d.ts
vendored
|
|
@ -45,6 +45,16 @@ interface BlobTrack extends TrackInfo {
|
|||
blob: Blob;
|
||||
}
|
||||
|
||||
interface LoadedURLTrack {
|
||||
url: string;
|
||||
metaData: {
|
||||
artist: string | null;
|
||||
title: string | null;
|
||||
album: string | null;
|
||||
albumArtUrl: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Many methods on the webamp instance deal with track.
|
||||
*
|
||||
|
|
@ -190,7 +200,7 @@ export default class Webamp {
|
|||
* @returns An "unsubscribe" function. Useful if at some point in the future you want to stop listening to these events.
|
||||
*/
|
||||
public onTrackDidChange(
|
||||
cb: (trackInfo: { url: string } | null) => void
|
||||
cb: (trackInfo: LoadedURLTrack | null) => void
|
||||
): () => void;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue