Skip to main content



  • registerServiceWorker(scope: string, scriptUrl: string): Promise<void>

  • Run this in the main application to register the service worker or reload the registered worker if the app expects a different version than the currently registered one.


    • scope: string

      The numeric value used in the path prefix of the site this service worker is meant to serve. E.g. for a prefix like /scope:793/, the scope would be 793. See the @php-wasm/scopes package for more details.

    • scriptUrl: string

      The URL of the service worker script.

    Returns Promise<void>