Loading karaokatalog/ui/static/model/Song.js 0 → 100644 +24 −0 Original line number Diff line number Diff line import { Base } from "./Base.js" import { getFavoriteIds, addFavorite, removeFavorite } from "./favorites.js" export default class Song extends Base { static async forceLoad() { return await m.request({ url: "/songs.json" }) } get favorite() { return getFavoriteIds().has(this.id || this.uuid) } set favorite(isFavorite) { if (isFavorite) { addFavorite(this.id || this.uuid) } else { removeFavorite(this.id || this.uuid) } } toggleFavorite() { this.favorite = !this.favorite } } Loading
karaokatalog/ui/static/model/Song.js 0 → 100644 +24 −0 Original line number Diff line number Diff line import { Base } from "./Base.js" import { getFavoriteIds, addFavorite, removeFavorite } from "./favorites.js" export default class Song extends Base { static async forceLoad() { return await m.request({ url: "/songs.json" }) } get favorite() { return getFavoriteIds().has(this.id || this.uuid) } set favorite(isFavorite) { if (isFavorite) { addFavorite(this.id || this.uuid) } else { removeFavorite(this.id || this.uuid) } } toggleFavorite() { this.favorite = !this.favorite } }