Skip to content

Commit 8a97895

Browse files
committed
Support firing a custom event on click
1 parent 6d531ac commit 8a97895

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/MenuBar/MenuBar.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class MenuBar
3030

3131
protected bool $alwaysOnTop = false;
3232

33+
protected ?string $event = null;
34+
3335
protected bool $showDockIcon = false;
3436

3537
protected Client $client;
@@ -95,6 +97,13 @@ public function alwaysOnTop($alwaysOnTop = true): self
9597
return $this;
9698
}
9799

100+
public function event(string $event): self
101+
{
102+
$this->event = $event;
103+
104+
return $this;
105+
}
106+
98107
public function withContextMenu(Menu $menu): self
99108
{
100109
$this->contextMenu = $menu;
@@ -122,6 +131,7 @@ public function toArray(): array
122131
'onlyShowContextMenu' => $this->onlyShowContextMenu,
123132
'contextMenu' => ! is_null($this->contextMenu) ? $this->contextMenu->toArray()['submenu'] : null,
124133
'alwaysOnTop' => $this->alwaysOnTop,
134+
'event' => $this->event,
125135
];
126136
}
127137
}

0 commit comments

Comments
 (0)