Skip to content

Commit 4f6a70a

Browse files
authored
Merge pull request #144 from braceyourself/main
Add hide window functionality
2 parents 4f98c2f + ef82ca3 commit 4f6a70a

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/Events/Windows/WindowHidden.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Native\Laravel\Events\Windows;
4+
5+
use Illuminate\Broadcasting\Channel;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
8+
use Illuminate\Foundation\Events\Dispatchable;
9+
use Illuminate\Queue\SerializesModels;
10+
11+
class WindowHidden implements ShouldBroadcastNow
12+
{
13+
use Dispatchable, InteractsWithSockets, SerializesModels;
14+
15+
public function __construct(public string $id)
16+
{
17+
//
18+
}
19+
20+
public function broadcastOn()
21+
{
22+
return [
23+
new Channel('nativephp'),
24+
];
25+
}
26+
}

src/Windows/WindowManager.php

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ public function close($id = null)
2626
]);
2727
}
2828

29+
public function hide($id = null)
30+
{
31+
return $this->client->post('window/hide', [
32+
'id' => $id ?? $this->detectId(),
33+
]);
34+
}
35+
2936
public function current()
3037
{
3138
return (object) $this->client->get('window/current')->json();

0 commit comments

Comments
 (0)