-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor event listeners and service workers
The code has been refactored to simplify event listeners and service workers. Redundant event listeners have been removed and replaced with a single FileCompileEventListener. The logic for serving manifest files and service workers has been abstracted into a FileCompilerInterface, which is implemented by ServiceWorkerCompiler and ManifestCompiler. This results in more modular and coherent architecture.
- Loading branch information
Showing
10 changed files
with
281 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SpomkyLabs\PwaBundle\Service; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final readonly class Data | ||
{ | ||
/** | ||
* @param string[] $headers | ||
*/ | ||
public function __construct( | ||
public string $url, | ||
public string $data, | ||
public array $headers | ||
){ | ||
} | ||
|
||
/** | ||
* @param array<string, string> $headers | ||
*/ | ||
public static function create(string $url, string $data, array $headers = []): self | ||
{ | ||
return new self($url, $data, $headers); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SpomkyLabs\PwaBundle\Service; | ||
|
||
interface FileCompilerInterface | ||
{ | ||
/** | ||
* @return array<string> | ||
*/ | ||
public function supportedPublicUrls(): array; | ||
|
||
public function get(string $publicUrl): null|Data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.