Skip to content

Commit

Permalink
Merge pull request #144 from braceyourself/main
Browse files Browse the repository at this point in the history
Add hide window functionality
  • Loading branch information
simonhamp authored Apr 1, 2024
2 parents 4f98c2f + ef82ca3 commit 4f6a70a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Events/Windows/WindowHidden.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Native\Laravel\Events\Windows;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class WindowHidden implements ShouldBroadcastNow
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct(public string $id)
{
//
}

public function broadcastOn()
{
return [
new Channel('nativephp'),
];
}
}
7 changes: 7 additions & 0 deletions src/Windows/WindowManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ public function close($id = null)
]);
}

public function hide($id = null)
{
return $this->client->post('window/hide', [
'id' => $id ?? $this->detectId(),
]);
}

public function current()
{
return (object) $this->client->get('window/current')->json();
Expand Down

0 comments on commit 4f6a70a

Please sign in to comment.