minor refactors

This commit is contained in:
geoffrey45
2021-12-27 16:38:19 +03:00
parent 4f80ce29bb
commit da2a831d37
2 changed files with 12 additions and 11 deletions
+10 -8
View File
@@ -2,38 +2,40 @@ import perks from "./perks.js";
import playAudio from "./playAudio.js";
let showMediaNotif = () => {
let current = perks.current.value;
if ("mediaSession" in navigator) {
navigator.mediaSession.metadata = new window.MediaMetadata({
title: perks.current.value.title,
artist: perks.current.value.artists,
title: current.title,
artist: current.artists,
artwork: [
{
src: perks.current.value.image,
src: current.image,
sizes: "96x96",
type: "image/jpeg",
},
{
src: perks.current.value.image,
src: current.image,
sizes: "128x128",
type: "image/png",
},
{
src: perks.current.value.image,
src: current.image,
sizes: "192x192",
type: "image/png",
},
{
src: perks.current.value.image,
src: current.image,
sizes: "256x256",
type: "image/png",
},
{
src: perks.current.value.image,
src: current.image,
sizes: "384x384",
type: "image/png",
},
{
src: perks.current.value.image,
src: current.image,
sizes: "512x512",
type: "image/png",
},
+2 -3
View File
@@ -1,7 +1,7 @@
import { ref } from "@vue/reactivity";
import { watch } from "@vue/runtime-core";
import media from './mediaNotification.js'
import media from "./mediaNotification.js";
const current = ref({
title: "Nothing played yet",
@@ -82,7 +82,7 @@ const readQueue = () => {
};
watch(current, (new_current, old_current) => {
media.showMediaNotif()
media.showMediaNotif();
localStorage.setItem("current", JSON.stringify(new_current));
const index = queue.value.findIndex(
@@ -113,5 +113,4 @@ watch(current, (new_current, old_current) => {
}, 1000);
});
export default { putCommas, doThat, readQueue, current, queue, next, prev };