mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
initialize active services on event app.initialization.start
This commit is contained in:
parent
bcd285f549
commit
ef642231df
@ -123,7 +123,7 @@ class MusicSyncSubCore {
|
|||||||
this.eventBus.emit("room:owner:changed", data)
|
this.eventBus.emit("room:owner:changed", data)
|
||||||
},
|
},
|
||||||
// Room Control
|
// Room Control
|
||||||
"music:player:start": (data) => {
|
"music:player:state": (data) => {
|
||||||
if (data.command_issuer === app.userData._id) {
|
if (data.command_issuer === app.userData._id) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ class MusicSyncSubCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatchEvent(eventName, data) {
|
dispatchEvent(eventName, data) {
|
||||||
if (!eventName) {
|
if (!eventName || !this.currentRoomData) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +382,25 @@ export default class SyncCore extends Core {
|
|||||||
}.bind(this),
|
}.bind(this),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events = {
|
||||||
|
"app.initialization.start": async () => {
|
||||||
|
const activeServices = await SyncModel.getLinkedServices().catch((error) => {
|
||||||
|
this.console.error(error)
|
||||||
|
return null
|
||||||
|
})
|
||||||
|
|
||||||
|
if (activeServices) {
|
||||||
|
this.console.log(`Active services`, activeServices)
|
||||||
|
this.activeLinkedServices = activeServices
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async onInitialize() {
|
async onInitialize() {
|
||||||
|
for (const [key, value] of Object.entries(this.events)) {
|
||||||
|
app.eventBus.on(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
const subCores = [
|
const subCores = [
|
||||||
new MusicSyncSubCore(this.ctx)
|
new MusicSyncSubCore(this.ctx)
|
||||||
]
|
]
|
||||||
@ -402,15 +420,6 @@ export default class SyncCore extends Core {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async initializeAfterCoresInit() {
|
// async initializeAfterCoresInit() {
|
||||||
const activeServices = await SyncModel.getLinkedServices().catch((error) => {
|
// }
|
||||||
this.console.error(error)
|
|
||||||
return null
|
|
||||||
})
|
|
||||||
|
|
||||||
if (activeServices) {
|
|
||||||
this.console.log(`Active services`, activeServices)
|
|
||||||
this.activeLinkedServices = activeServices
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user