mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-07 11:04:11 +08:00
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
const remote = require('@electron/remote');
|
|
const { ipcRenderer } = require('electron');
|
|
|
|
const ipcSendSync = (type, data) => {
|
|
const returnValue = ipcRenderer.sendSync('msg-trigger', {
|
|
type,
|
|
data,
|
|
});
|
|
if (returnValue instanceof Error) throw returnValue;
|
|
return returnValue;
|
|
};
|
|
|
|
const ipcSend = (type, data) => {
|
|
ipcRenderer.send('msg-trigger', {
|
|
type,
|
|
data,
|
|
});
|
|
};
|
|
|
|
window.market = {
|
|
getLocalPlugins() {
|
|
return remote.getGlobal('LOCAL_PLUGINS').getLocalPlugins();
|
|
},
|
|
downloadPlugin(plugin) {
|
|
return remote.getGlobal('LOCAL_PLUGINS').downloadPlugin(plugin);
|
|
},
|
|
deletePlugin(plugin) {
|
|
return remote.getGlobal('LOCAL_PLUGINS').deletePlugin(plugin);
|
|
},
|
|
refreshPlugin(plugin) {
|
|
return remote.getGlobal('LOCAL_PLUGINS').refreshPlugin(plugin);
|
|
},
|
|
addLocalStartPlugin(plugin) {
|
|
ipcSend('addLocalStartPlugin', { plugin });
|
|
},
|
|
removeLocalStartPlugin(plugin) {
|
|
ipcSend('removeLocalStartPlugin', { plugin });
|
|
},
|
|
dbDump(target) {
|
|
ipcSend('dbDump', { target });
|
|
},
|
|
|
|
dbImport(target) {
|
|
ipcSend('dbImport', { target });
|
|
},
|
|
};
|