mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 11:52:07 +08:00
优化代码
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user