mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +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)
|
||||
},
|
||||
// Room Control
|
||||
"music:player:start": (data) => {
|
||||
"music:player:state": (data) => {
|
||||
if (data.command_issuer === app.userData._id) {
|
||||
return false
|
||||
}
|
||||
@ -224,7 +224,7 @@ class MusicSyncSubCore {
|
||||
}
|
||||
|
||||
dispatchEvent(eventName, data) {
|
||||
if (!eventName) {
|
||||
if (!eventName || !this.currentRoomData) {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -382,7 +382,25 @@ export default class SyncCore extends Core {
|
||||
}.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() {
|
||||
for (const [key, value] of Object.entries(this.events)) {
|
||||
app.eventBus.on(key, value)
|
||||
}
|
||||
|
||||
const subCores = [
|
||||
new MusicSyncSubCore(this.ctx)
|
||||
]
|
||||
@ -402,15 +420,6 @@ export default class SyncCore extends Core {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
// async initializeAfterCoresInit() {
|
||||
// }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user