Class WebShareBinding
java.lang.Object
com.vaadin.flow.component.webshare.WebShareBinding
- All Implemented Interfaces:
Serializable
Fluent surface returned from
WebShare.onClick(T). Each share
action attaches one ShareAction to the underlying Trigger.
Actions come in two flavours: fire-and-forget (one argument) and observed
(with onShared/onError callbacks). onShared fires
after the user picks a share target; onError fires when the user
dismisses the sheet (the browser reports AbortError) or when the call
is rejected for other reasons (no gesture, permissions policy block,
unsupported browser). Both consumers are required in the observed form — pass
() -> {} or err -> {} to opt out of one.
Button share = new Button("Share");
WebShare.onClick(share).share(
ShareContent.create().title("Hello").url("https://vaadin.com"));
WebShare.onClick(share).share(
ShareContent.create().url("https://vaadin.com"),
() -> Notification.show("Shared!"),
err -> Notification.show("Cancelled: " + err.name()));
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidshare(ShareContent content) Invokes the browser's native share sheet with the given content when the underlying trigger fires.voidshare(ShareContent content, SerializableRunnable onShared, SerializableConsumer<PromiseAction.Error> onError) Likeshare(ShareContent)but reports the outcome back to the server.
-
Method Details