If needed, you can define custom sections in the service worker appended by your own services and depending on your application configuration or requirements.
To do so, you can create a service that implements SpomkyLabs\PwaBundle\ServiceWorkerRule\ServiceWorkerRule.
The method process shall return valid JS as a string. This script will be executed by browsers.
<?phpdeclare(strict_types=1);namespaceAcme;use SpomkyLabs\PwaBundle\ServiceWorkerRule\ServiceWorkerRule;finalreadonlyclassMyCustomRuleimplementsServiceWorkerRule{private Workbox $workbox;publicfunction__construct( ServiceWorker $serviceWorker,){$this->workbox =$serviceWorker->workbox;}publicfunctionprocess(bool$debug =false):string{return<<<HELLO_WORLD// This will be added to the Service Workerconsole.log('FOO-BAR from the Service Worker!');HELLO_WORLD;}}