完成同步功能
This commit is contained in:
@@ -23,3 +23,4 @@ require('./musicUrl')
|
||||
require('./kw_decodeLyric')
|
||||
|
||||
require('./userApi')
|
||||
require('./sync')
|
||||
|
||||
@@ -24,6 +24,7 @@ mainOn(ipcMainWindowNames.save_playlist, (event, { type, data }) => {
|
||||
switch (type) {
|
||||
case 'myList':
|
||||
handleSaveList(data)
|
||||
global.lx_event.common.saveMyList(data)
|
||||
break
|
||||
case 'downloadList':
|
||||
getStore('downloadList').set('list', data)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
const { mainSend, NAMES: { mainWindow: ipcMainWindowNames }, mainOn, mainHandle } = require('@common/ipc')
|
||||
const { eventNames, modules, startServer, stopServer, getStatus, generateCode } = require('../modules/sync')
|
||||
|
||||
|
||||
mainOn(ipcMainWindowNames.sync_action_list, (event, { action, data }) => {
|
||||
modules.list.sendListAction(action, data)
|
||||
})
|
||||
|
||||
mainHandle(ipcMainWindowNames.sync_enable, (event, { enable, port }) => {
|
||||
return enable ? startServer(port) : stopServer()
|
||||
})
|
||||
|
||||
mainHandle(ipcMainWindowNames.sync_get_status, () => {
|
||||
return getStatus()
|
||||
})
|
||||
|
||||
mainHandle(ipcMainWindowNames.sync_generate_code, () => {
|
||||
return generateCode()
|
||||
})
|
||||
|
||||
mainOn(ipcMainWindowNames.sync_list, (event, { action, data }) => {
|
||||
global.lx_event.sync.sync_handle_list({ action, data })
|
||||
})
|
||||
|
||||
global.lx_event.sync.on(eventNames.sync_action_list, ({ action, data }) => {
|
||||
mainSend(global.modules.mainWindow, ipcMainWindowNames.sync_action_list, { action, data })
|
||||
})
|
||||
global.lx_event.sync.on(eventNames.status, status => {
|
||||
mainSend(global.modules.mainWindow, ipcMainWindowNames.sync_status, status)
|
||||
})
|
||||
global.lx_event.sync.on(eventNames.sync_list, ({ action, data }) => {
|
||||
mainSend(global.modules.mainWindow, ipcMainWindowNames.sync_list, { action, data })
|
||||
})
|
||||
Reference in New Issue
Block a user