MCPcopy Create free account
hub / github.com/jhen0409/react-native-debugger / changeMenuItems

Function changeMenuItems

electron/window.js:21–36  ·  view source on GitHub ↗
(menus)

Source from the content-addressed store, hash-verified

19const checkIsOpenInEditorEnabled = (win) => executeJavaScript(win, 'window.isOpenInEditorEnabled()')
20
21const changeMenuItems = (menus) => {
22 const rootMenuItems = Menu.getApplicationMenu().items
23 Object.entries(menus).forEach(([key, subMenu]) => {
24 const rootMenuItem = rootMenuItems.find(({ label }) => label === key)
25 if (!rootMenuItem || !rootMenuItem.submenu) return
26
27 Object.entries(subMenu).forEach(([subKey, menuSet]) => {
28 const menuItem = rootMenuItem.submenu.items.find(
29 ({ label }) => label === subKey,
30 )
31 if (!menuItem) return
32
33 Object.assign(menuItem, menuSet)
34 })
35 })
36}
37
38const invokeDevMethod = (win, name) => executeJavaScript(
39 win,

Callers 1

registerShortcutsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected