优化代码

This commit is contained in:
gsx
2022-04-23 18:43:13 +08:00
parent f3e8d31753
commit bde9c2c1d4

View File

@@ -19,24 +19,22 @@ const call = (ipc, channel, param) => {
/**
* 发送异步消息invoke/handle 模型)
* @param ipc
* @param channel
* @param param
* @returns {Promise}
*/
const invoke = (ipc, channel, param) => {
const invoke = (channel, param) => {
const message = ipc.invoke(channel, param);
return message;
}
/**
* 发送同步消息send/on 模型)
* @param ipc
* @param channel
* @param param
* @returns {Any}
*/
const sendSync = (ipc, channel, param) => {
const sendSync = (channel, param) => {
const message = ipc.sendSync(channel, param);
return message;
}
@@ -45,7 +43,7 @@ export default {
install(Vue) {
Vue.prototype.$ipc = ipc // 全局注入ipc
Vue.prototype.$ipcCall = (channel, param) => call(ipc, channel, param)
Vue.prototype.$ipcInvoke = (channel, param) => invoke(ipc, channel, param)
Vue.prototype.$ipcSendSync = (channel, param) => sendSync(ipc, channel, param)
Vue.prototype.$ipcInvoke = invoke
Vue.prototype.$ipcSendSync = sendSync
}
}