pinafore/src/routes/_actions/share.js
2019-02-14 21:26:28 -08:00

15 lines
426 B
JavaScript

import { toast } from '../_components/toast/toast'
import { statusHtmlToPlainText } from '../_utils/statusHtmlToPlainText'
export async function shareStatus (status) {
try {
await navigator.share({
title: status.spoiler_text || undefined,
text: statusHtmlToPlainText(status.content, status.mentions),
url: status.url
})
} catch (e) {
toast.say(`Unable to share: ` + (e.message || ''))
}
}