com.vaadin.flow.server.
Annotation Interface PWA
Defines application PWA properties. Annotation activates automatic PWA injecting.
Only one annotation for application is supported. Annotation must be placed to master layout. Application annotated the annotation will add following capabilities to Flow application:
- handle manifest.webmanifest
- handle sw.js (service worker), which will enable simple offline fallback and file caching
- handle default (static) offline html page
- handle different versions (sizes) of the given logo
- inject needed tags to the app's page header
Since:
1.2
See Also:
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionBackground color of the application.
Description of the application.
Defines the developers? preferred display mode for the website.
Path to the application icon file.
Path to the manifest file.
boolean
Whether the application should be available offline.
Path to the static offline html file.
String[]
Offline resources to be cached using the service worker.
(Root relative) start url, used in web-manifest, property start_url
Theme color of the application.
-
Element Details
-
-
offlinePath
String offlinePathPath to the static offline html file. Defaults to empty value, meaning that the application shell (`index .html` file) is used offline. If offline file is not found, the browser?s default ?unreachable site? message is shown.
Returns:
path to the static offline html file
Default:
""
-
manifestPath
String manifestPathPath to the manifest file. Defaults to (relative) manifest.webmanifest with default configuration that is webapp/manifest.webmanifest
Returns:
path to the manifest file
Default:
"manifest.webmanifest"
-
iconPath
String iconPathPath to the application icon file.
Defaults to (relative) icons/icon.png with default configuration that is webapp/manifest.webmanifest
If the specified icon file is not found, the default one will be used. The file is also used to create different sizes of icon.
Returns:
path to the application icon file
Default:
"icons/icon.png"
-
startPath
String startPath(Root relative) start url, used in web-manifest, property start_url
Used in manifest as start_url of application. Must be relative to root context. ie. If install address of application would be https://foo.bar.org/sub/ and wanted start url would be https://foo.bar.org/sub/pwa-start then value of startPath would be "pwa-start" (without leading "/").
Defaults to root of application.
Returns:
application start url
Default:
"."
-
description
String descriptionDescription of the application.
Returns:
description of the application
Default:
""
-
themeColor
String themeColorTheme color of the application. The theme color sets the color of the application's tool bar and application's color in the task switcher.
Returns:
theme color of the application
Default:
"#ffffff"
-
backgroundColor
String backgroundColorBackground color of the application. The background color property is used on the splash screen when the application is first launched.
Returns:
Background color of the application
Default:
"#f2f2f2"
-
display
String displayDefines the developers? preferred display mode for the website. Possible values: fullscreen, standalone, minimal-ui, browser
Returns:
display mode of application
Default:
"standalone"
-
offlineResources
String[] offlineResourcesOffline resources to be cached using the service worker.
Returns:
offline resources to be cached
Default:
{}
-
offline
boolean offlineWhether the application should be available offline.
Defaults to
true
, which enables the service worker script build. The service worker is required for the application to work offline and will be registered in the browser on the user's first visit.Setting to
false
disables the service worker script build. The active service worker, if one is running in the browser, will be unregistered on the user's next visit.Returns:
whether offline is enabled.
Default:
true
-