Package org.angular.ts.ng
Interface ServiceWorkerService
@JsType(isNative=true,
name="ng.ServiceWorkerService",
namespace="<global>")
public interface ServiceWorkerService
Injectable service-worker lifecycle and messaging facade.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceTypeScript callback contract for this method.static interfaceTypeScript callback contract for this method.static interfaceTypeScript callback contract for this method.static interfaceTypeScript callback contract for this method. -
Method Summary
Modifier and TypeMethodDescriptionelemental2.dom.ServiceWorkerCurrent native controller, if the page is controlled.elemental2.dom.ServiceWorkerRegistrationLatest known native registration.Template-friendly registration snapshot.Template-facing lifecycle status for the latest service-worker operation.Template-friendly update snapshot.booleanSupport flag for templates and guards.Subscribe to controller-change notifications.onMessage(ServiceWorkerService.OnMessageCallback<TData> callback) Subscribe to messages from the service worker container.Subscribe to update-state notifications.elemental2.promise.Promise<Void> post(Object message, ServiceWorkerPostOptions options) Send a message to the current controller or an explicit worker target.elemental2.promise.Promise<elemental2.dom.ServiceWorkerRegistration> ready()Resolve when the browser reports an active ready registration.elemental2.promise.Promise<elemental2.dom.ServiceWorkerRegistration> Register the configured script or an explicit script URL.<TResponse>
elemental2.promise.Promise<TResponse> request(Object message, ServiceWorkerRequestOptions options) Send a request through a dedicated `MessageChannel`.voidsetController(elemental2.dom.ServiceWorker controller) Current native controller, if the page is controlled.voidsetRegistration(elemental2.dom.ServiceWorkerRegistration registration) Latest known native registration.voidsetRegistrationState(ServiceWorkerRegistrationState registrationState) Template-friendly registration snapshot.voidTemplate-facing lifecycle status for the latest service-worker operation.voidsetSupported(boolean supported) Support flag for templates and guards.voidsetUpdateState(ServiceWorkerUpdateState updateState) Template-friendly update snapshot.elemental2.promise.Promise<Boolean> Unregister the latest known registration.elemental2.promise.Promise<elemental2.dom.ServiceWorkerRegistration> update()Ask the latest known registration to check for an updated worker.
-
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
Template-friendly registration snapshot. -
getStatus
Template-facing lifecycle status for the latest service-worker operation. -
getUpdateState
Template-friendly update snapshot. -
isSupported
@JsProperty boolean isSupported()Support flag for templates and guards. -
onControllerChange
ServiceWorkerService.Subscription onControllerChange(ServiceWorkerService.OnControllerChangeCallback callback) Subscribe to controller-change notifications.- Parameters:
callback- Value supplied for the callback parameter.- Returns:
- Method result.
-
onMessage
<TData> ServiceWorkerService.Subscription onMessage(ServiceWorkerService.OnMessageCallback<TData> callback) 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
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
Template-friendly registration snapshot. -
setStatus
Template-facing lifecycle status for the latest service-worker operation. -
setSupported
@JsProperty void setSupported(boolean supported) Support flag for templates and guards. -
setUpdateState
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.
-