com.vaadin.flow.server.
Annotation Type PWA
-
@Retention(RUNTIME) @Target(TYPE) public @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:
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description String
backgroundColor
Background color of the application.
String
description
Description of the application.
String
display
Defines the developers? preferred display mode for the website.
String
iconPath
Path to the application icon file.
String
manifestPath
Path to the manifest file.
boolean
offline
Whether the application should be available offline.
String
offlinePath
Path to the static offline html file.
String[]
offlineResources
Offline resources to be cached using the service worker.
String
startPath
(Root relative) start url, used in web-manifest, property start_url
String
themeColor
Theme color of the application.
-
-
-
Element Detail
-
name
String name
Name of the application.
Returns:
name of the application
-
-
-
shortName
String shortName
Short name for the application. Maximum of 12 characters.
Returns:
short name for the application
-
-
-
offlinePath
String offlinePath
Path 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 manifestPath
Path 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 iconPath
Path 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 description
Description of the application.
Returns:
description of the application
Default:
""
-
-
-
themeColor
String themeColor
Theme 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 backgroundColor
Background 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 display
Defines the developers? preferred display mode for the website. Possible values: fullscreen, standalone, minimal-ui, browser
Returns:
display mode of application
Default:
"standalone"
-
-
-
offlineResources
String[] offlineResources
Offline resources to be cached using the service worker.
Returns:
offline resources to be cached
Default:
{}
-
-
-
offline
boolean offline
Whether 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
-
-