Skip to content

Commit a29f2b6

Browse files
committed
Allow setting title and URL
1 parent a20ac2e commit a29f2b6

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/Windows/Window.php

+24-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
class Window
1212
{
1313
use HasDimensions;
14-
use HasUrl;
14+
use HasUrl {
15+
HasUrl::url as defaultUrl;
16+
}
1517
use HasVibrancy;
1618

1719
protected bool $autoHideMenuBar = false;
@@ -77,6 +79,27 @@ public function title(string $title): self
7779
{
7880
$this->title = $title;
7981

82+
if (! $this instanceof PendingOpenWindow) {
83+
$this->client->post('window/title', [
84+
'id' => $this->id,
85+
'title' => $title,
86+
]);
87+
}
88+
89+
return $this;
90+
}
91+
92+
public function url(string $url)
93+
{
94+
$this->defaultUrl($url);
95+
96+
if (! $this instanceof PendingOpenWindow) {
97+
$this->client->post('window/url', [
98+
'id' => $this->id,
99+
'url' => $url,
100+
]);
101+
}
102+
80103
return $this;
81104
}
82105

0 commit comments

Comments
 (0)