mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-02-03 20:55:38 +01:00
22 lines
563 B
JavaScript
22 lines
563 B
JavaScript
import { BrowserWindow, ipcMain, Menu } from 'electron'
|
|
|
|
export default function (controlWindow) {
|
|
ipcMain.handle('open-device-gnirehtet-menu', openDeviceGnirehtetMenu)
|
|
|
|
function openDeviceGnirehtetMenu(event, args = {}) {
|
|
const { options = [] } = args
|
|
|
|
const template = options.map((item) => {
|
|
return {
|
|
label: item.label,
|
|
click() {
|
|
controlWindow.webContents.send(item.value)
|
|
},
|
|
}
|
|
})
|
|
|
|
const menu = Menu.buildFromTemplate(template)
|
|
menu.popup(BrowserWindow.fromWebContents(event.sender))
|
|
}
|
|
}
|