mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
fix naming
This commit is contained in:
parent
493c09cab9
commit
e92f8f852c
26
packages/app/src/classes/ActivityEvent/index.js
Normal file
26
packages/app/src/classes/ActivityEvent/index.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
export default class ActivityEvent {
|
||||||
|
constructor(id, payload) {
|
||||||
|
if (typeof id !== "string") {
|
||||||
|
console.error("Event id is required")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.id = id
|
||||||
|
this.payload = payload
|
||||||
|
|
||||||
|
this.send().catch((err) => {
|
||||||
|
console.error("Failed to send remote event >", err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
send = async () => {
|
||||||
|
app.cores.api.customRequest({
|
||||||
|
url: "/activity/client",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
id: this.id,
|
||||||
|
payload: this.payload,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -1,26 +0,0 @@
|
|||||||
export default class RemoteEvent {
|
|
||||||
constructor(id, payload) {
|
|
||||||
if (typeof id !== "string") {
|
|
||||||
console.error("Event id is required")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.id = id
|
|
||||||
this.payload = payload
|
|
||||||
|
|
||||||
this.send().catch((err) => {
|
|
||||||
console.error("Failed to send remote event >", err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
send = async () => {
|
|
||||||
app.cores.api.customRequest({
|
|
||||||
url: "/events/client",
|
|
||||||
method: "POST",
|
|
||||||
data: {
|
|
||||||
id: this.id,
|
|
||||||
payload: this.payload
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
import { Core } from "@ragestudio/vessel"
|
import { Core } from "@ragestudio/vessel"
|
||||||
|
|
||||||
import RemoteEvent from "@classes/RemoteEvent"
|
import ActivityEvent from "@classes/ActivityEvent"
|
||||||
import QueueManager from "@classes/QueueManager"
|
import QueueManager from "@classes/QueueManager"
|
||||||
import TrackInstance from "./classes/TrackInstance"
|
import TrackInstance from "./classes/TrackInstance"
|
||||||
//import MediaSession from "./classes/MediaSession"
|
//import MediaSession from "./classes/MediaSession"
|
||||||
@ -201,7 +201,7 @@ export default class Player extends Core {
|
|||||||
|
|
||||||
// send the event to the server
|
// send the event to the server
|
||||||
if (item.manifest._id && item.manifest.service === "default") {
|
if (item.manifest._id && item.manifest.service === "default") {
|
||||||
new RemoteEvent("player.play", {
|
new ActivityEvent("player.play", {
|
||||||
identifier: "unique", // this must be unique to prevent duplicate events and ensure only have unique track events
|
identifier: "unique", // this must be unique to prevent duplicate events and ensure only have unique track events
|
||||||
track_id: item.manifest._id,
|
track_id: item.manifest._id,
|
||||||
service: item.manifest.service,
|
service: item.manifest.service,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user