Interface ServiceWorkerService


@JsType(isNative=true, name="ng.ServiceWorkerService", namespace="<global>") public interface ServiceWorkerService
Injectable service-worker lifecycle and messaging facade.
  • Method Details

    • getController

      @JsProperty elemental2.dom.ServiceWorker getController()
      Current native controller, if the page is controlled.
    • getRegistration

      @JsProperty elemental2.dom.ServiceWorkerRegistration getRegistration()
      Latest known native registration.
    • getRegistrationState

      @JsProperty ServiceWorkerRegistrationState getRegistrationState()
      Template-friendly registration snapshot.
    • getStatus

      @JsProperty String getStatus()
      Template-facing lifecycle status for the latest service-worker operation.
    • getUpdateState

      @JsProperty ServiceWorkerUpdateState getUpdateState()
      Template-friendly update snapshot.
    • isSupported

      @JsProperty boolean isSupported()
      Support flag for templates and guards.
    • onControllerChange

      Subscribe to controller-change notifications.
      Parameters:
      callback - Value supplied for the callback parameter.
      Returns:
      Method result.
    • onMessage

      Subscribe to messages from the service worker container.
      Parameters:
      callback - Value supplied for the callback parameter.
      Returns:
      Method result.
    • onUpdate

      Subscribe to update-state notifications.
      Parameters:
      callback - Value supplied for the callback parameter.
      Returns:
      Method result.
    • post

      elemental2.promise.Promise<Void> post(Object message, ServiceWorkerPostOptions options)
      Send a message to the current controller or an explicit worker target.
      Parameters:
      message - Value supplied for the message parameter.
      options - Value supplied for the options parameter.
      Returns:
      Method result.
    • ready

      elemental2.promise.Promise<elemental2.dom.ServiceWorkerRegistration> ready()
      Resolve when the browser reports an active ready registration.
      Returns:
      Method result.
    • register

      elemental2.promise.Promise<elemental2.dom.ServiceWorkerRegistration> register(Object scriptOrOptions, elemental2.dom.RegistrationOptions options)
      Register the configured script or an explicit script URL.
      Parameters:
      scriptOrOptions - Value supplied for the scriptOrOptions parameter.
      options - Value supplied for the options parameter.
      Returns:
      Method result.
    • request

      <TResponse> elemental2.promise.Promise<TResponse> request(Object message, ServiceWorkerRequestOptions options)
      Send a request through a dedicated `MessageChannel`.
      Parameters:
      message - Value supplied for the message parameter.
      options - Value supplied for the options parameter.
      Returns:
      Method result.
    • setController

      @JsProperty void setController(elemental2.dom.ServiceWorker controller)
      Current native controller, if the page is controlled.
    • setRegistration

      @JsProperty void setRegistration(elemental2.dom.ServiceWorkerRegistration registration)
      Latest known native registration.
    • setRegistrationState

      @JsProperty void setRegistrationState(ServiceWorkerRegistrationState registrationState)
      Template-friendly registration snapshot.
    • setStatus

      @JsProperty void setStatus(String status)
      Template-facing lifecycle status for the latest service-worker operation.
    • setSupported

      @JsProperty void setSupported(boolean supported)
      Support flag for templates and guards.
    • setUpdateState

      @JsProperty void setUpdateState(ServiceWorkerUpdateState updateState)
      Template-friendly update snapshot.
    • unregister

      elemental2.promise.Promise<Boolean> unregister()
      Unregister the latest known registration.
      Returns:
      Method result.
    • update

      elemental2.promise.Promise<elemental2.dom.ServiceWorkerRegistration> update()
      Ask the latest known registration to check for an updated worker.
      Returns:
      Method result.