2020-10-20 01:33:06 +00:00
|
|
|
import { BrowserWindow, Menu, SharingItem, PopupOptions } from 'electron/main';
|
2023-10-25 18:02:15 +00:00
|
|
|
import { EventEmitter } from 'events';
|
2020-10-20 01:33:06 +00:00
|
|
|
|
2023-10-25 18:02:15 +00:00
|
|
|
class ShareMenu extends EventEmitter implements Electron.ShareMenu {
|
2020-10-20 01:33:06 +00:00
|
|
|
private menu: Menu;
|
|
|
|
|
|
|
|
constructor (sharingItem: SharingItem) {
|
2023-10-25 18:02:15 +00:00
|
|
|
super();
|
2020-10-20 01:33:06 +00:00
|
|
|
this.menu = new (Menu as any)({ sharingItem });
|
|
|
|
}
|
|
|
|
|
|
|
|
popup (options?: PopupOptions) {
|
|
|
|
this.menu.popup(options);
|
|
|
|
}
|
|
|
|
|
|
|
|
closePopup (browserWindow?: BrowserWindow) {
|
|
|
|
this.menu.closePopup(browserWindow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ShareMenu;
|