mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-21 12:27:02 -04:00
update dependencies and @vencord/types package
This commit is contained in:
parent
05566aed15
commit
edf6480b8f
14 changed files with 606 additions and 1063 deletions
|
@ -77,7 +77,7 @@ export const SpotifyStore = proxyLazyWebpack(() => {
|
|||
|
||||
class SpotifyStore extends Store {
|
||||
public mPosition = 0;
|
||||
private start = 0;
|
||||
public _start = 0;
|
||||
|
||||
public track: Track | null = null;
|
||||
public device: Device | null = null;
|
||||
|
@ -100,26 +100,26 @@ export const SpotifyStore = proxyLazyWebpack(() => {
|
|||
public get position(): number {
|
||||
let pos = this.mPosition;
|
||||
if (this.isPlaying) {
|
||||
pos += Date.now() - this.start;
|
||||
pos += Date.now() - this._start;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
public set position(p: number) {
|
||||
this.mPosition = p;
|
||||
this.start = Date.now();
|
||||
this._start = Date.now();
|
||||
}
|
||||
|
||||
prev() {
|
||||
this.req("post", "/previous");
|
||||
this._req("post", "/previous");
|
||||
}
|
||||
|
||||
next() {
|
||||
this.req("post", "/next");
|
||||
this._req("post", "/next");
|
||||
}
|
||||
|
||||
setVolume(percent: number) {
|
||||
this.req("put", "/volume", {
|
||||
this._req("put", "/volume", {
|
||||
query: {
|
||||
volume_percent: Math.round(percent)
|
||||
}
|
||||
|
@ -131,17 +131,17 @@ export const SpotifyStore = proxyLazyWebpack(() => {
|
|||
}
|
||||
|
||||
setPlaying(playing: boolean) {
|
||||
this.req("put", playing ? "/play" : "/pause");
|
||||
this._req("put", playing ? "/play" : "/pause");
|
||||
}
|
||||
|
||||
setRepeat(state: Repeat) {
|
||||
this.req("put", "/repeat", {
|
||||
this._req("put", "/repeat", {
|
||||
query: { state }
|
||||
});
|
||||
}
|
||||
|
||||
setShuffle(state: boolean) {
|
||||
this.req("put", "/shuffle", {
|
||||
this._req("put", "/shuffle", {
|
||||
query: { state }
|
||||
}).then(() => {
|
||||
this.shuffle = state;
|
||||
|
@ -154,7 +154,7 @@ export const SpotifyStore = proxyLazyWebpack(() => {
|
|||
|
||||
this.isSettingPosition = true;
|
||||
|
||||
return this.req("put", "/seek", {
|
||||
return this._req("put", "/seek", {
|
||||
query: {
|
||||
position_ms: Math.round(ms)
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ export const SpotifyStore = proxyLazyWebpack(() => {
|
|||
});
|
||||
}
|
||||
|
||||
private req(method: "post" | "get" | "put", route: string, data: any = {}) {
|
||||
_req(method: "post" | "get" | "put", route: string, data: any = {}) {
|
||||
if (this.device?.is_active)
|
||||
(data.query ??= {}).device_id = this.device.id;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue