2021-12-24 15:02:52 -08:00
|
|
|
import noop from 'utilities/noop';
|
2021-08-10 06:50:17 -07:00
|
|
|
|
2021-12-26 14:01:16 -08:00
|
|
|
export function shareEventHandler(event: Event): void {
|
2021-12-26 14:46:42 -08:00
|
|
|
event.preventDefault();
|
2021-12-26 14:01:16 -08:00
|
|
|
const answerbox = (event.target as HTMLElement).closest('.answerbox');
|
|
|
|
|
|
|
|
navigator.share({
|
|
|
|
url: answerbox.querySelector<HTMLAnchorElement>('.answerbox__answer-date > a, a.answerbox__permalink').href
|
|
|
|
})
|
2021-08-10 06:50:17 -07:00
|
|
|
.then(noop)
|
|
|
|
.catch(noop)
|
2021-08-10 04:16:40 -07:00
|
|
|
}
|