Class Share
java.lang.Object
org.vaadin.firitin.util.Share
A simple wrapper for the Web Share API. Allows sharing text and URLs quickly via OS
native share dialog, if the browser supports the Web Share (~ all but FF).
On Firefox (which does not support the Web Share API), it falls back to copying the text and URL to the clipboard and showing a notification on the screen.
See also: https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
setFirefoxFallbackNotification
(Runnable firefoxFallbackNotification) Sets the action executed when the Web Share API is not supported (e.g. on Firefox).static com.vaadin.flow.component.page.PendingJavaScriptResult
Share a link using the Web Share API.static com.vaadin.flow.component.page.PendingJavaScriptResult
Share a link using the Web Share API.static com.vaadin.flow.component.page.PendingJavaScriptResult
share
(Share.ShareData data)
-
Constructor Details
-
Share
public Share()
-
-
Method Details
-
setFirefoxFallbackNotification
Sets the action executed when the Web Share API is not supported (e.g. on Firefox). By default, it shows a notification that the URL has been copied to clipboard. Use e.g. to show a custom message.- Parameters:
firefoxFallbackNotification
- the action to execute when the Web Share API is not supported.
-