@rtorcato/browser-common / webshare
webshare
Functions
isWebShareAvailable()
isWebShareAvailable():
boolean
Defined in: webshare/index.ts:9
Checks if the Web Share API is available in the current browser.
Returns
boolean
Example
import { isWebShareAvailable } from '@rtorcato/browser-common/webshare'
if (isWebShareAvailable()) showShareButton()
share()
share(
data):Promise<void>
Defined in: webshare/index.ts:23
Shares data using the Web Share API.
Parameters
data
ShareData
The data to share (title, text, url, files).
Returns
Promise<void>
A promise that resolves if sharing was successful.
Example
import { share } from '@rtorcato/browser-common/webshare'
await share({ title: 'Look', url: 'https://example.com' })
isFileShareAvailable()
isFileShareAvailable():
boolean
Defined in: webshare/index.ts:38
Checks if the Web Share API supports sharing files.
Returns
boolean
Example
import { isFileShareAvailable } from '@rtorcato/browser-common/webshare'
if (isFileShareAvailable()) showShareFilesButton()