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

12 lines
318 B
TypeScript
Raw Normal View History

import noop from 'utilities/noop';
2021-08-10 06:50:17 -07:00
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, a.answerbox__permalink').href
2021-08-10 04:16:40 -07:00
})
2021-08-10 06:50:17 -07:00
.then(noop)
.catch(noop)
2021-08-10 04:16:40 -07:00
}
}