Class: ShareMenu

Create share menu on macOS.

进程:主进程

The ShareMenu class creates Share Menu on macOS, which can be used to share information from the current context to apps, social media accounts, and other services.

For including the share menu as a submenu of other menus, please use the shareMenu role of MenuItem.

new ShareMenu(sharingItem)

  • sharingItem SharingItem - The item to share.

Creates a new share menu.

实例方法

The shareMenu object has the following instance methods:

shareMenu.popup([options])

  • options PopupOptions (optional)
    • browserWindow BrowserWindow (可选) - 默认为选中窗口.
    • x Number (可选) - 默认为当前鼠标的位置。 如果指定了y,则该选项必选。
    • y Number (可选) - 默认为当前鼠标的位置。 如果指定了x,则该选项必选。
    • positioningItem Number (optional) macOS - The index of the menu item to be positioned under the mouse cursor at the specified coordinates. 默认值为 -1。
    • callback Function (optional) - 会在菜单关闭后被调用.

将此菜单作为 browserWindow 中的上下文菜单弹出。

shareMenu.closePopup([browserWindow])

关闭 browserWindow 中的上下文菜单。