Retrospring/app/javascript/retrospring/features/answerbox/share.ts

12 lines
383 B
TypeScript
Raw Normal View History

2021-08-10 04:16:40 -07:00
export function createShareEvent(answerbox: HTMLElement): () => void {
return function (): void {
navigator.share({
url: answerbox.querySelector<HTMLAnchorElement>('.answerbox__answer-date > a').href
}).then(() => {
// do nothing, prevents exce ption from being thrown
}).catch(() => {
// do nothing, prevents exception from being thrown
})
}
}