com.vaadin.flow.server.
Annotation Type PWA
-
@Retention(value=RUNTIME) @Target(value=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
-
-
Required Element Summary
Required Elements Modifier and Type Required Element and Description String
name
Name of the application.
String
shortName
Short name for the application.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element and 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.
boolean
enableInstallPrompt
If enabled, server will inject default pwa -install prompt html and js in bootstrap page.
String
iconPath
Path to the application icon file.
String
manifestPath
Path to the manifest file.
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
public abstract String name
Name of the application.
Returns:
name of the application
-
-
-
shortName
public abstract String shortName
Short name for the application. Maximum of 12 characters.
Returns:
short name for the application
-
-
-
offlinePath
public abstract String offlinePath
Path to the static offline html file. Defaults to (relative) offline.html with default configuration that is webapp/offline.html If offline file is not found, falls back to default offline page.
Returns:
path to the static offline html file
Default:
"offline.html"
-
-
-
manifestPath
public abstract 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
public abstract 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
public abstract 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
public abstract String description
Description of the application.
Returns:
description of the application
Default:
""
-
-
-
themeColor
public abstract 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
public abstract 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
public abstract 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
public abstract String[] offlineResources
Offline resources to be cached using the service worker.
Returns:
offline resources to be cached
Default:
{}
-
-
-
enableInstallPrompt
public abstract boolean enableInstallPrompt
If enabled, server will inject default pwa -install prompt html and js in bootstrap page.
Will capture beforeinstallprompt -event and show install prompt as required from Chrome 68 upwards.
Returns:
are pwa -install prompt resources injected.
Default:
true
-
-