Files
wanderer/assets/js/hooks/copyToClipboard.ts
guarzo ead5818a3f feat(Map): api to allow systematic access to visible systems and tracked characters (#89)
* feat: add limited api for system and tracked characters
* env variable to disable public api key
2025-01-07 13:16:39 +04:00

21 lines
438 B
TypeScript

export default {
mounted() {
const button = this.el;
button.addEventListener('click', function () {
button.classList.remove('copied');
// Copy the URL to the clipboard
navigator.clipboard
.writeText(button.dataset.url)
.then(() => {
button.classList.add('copied');
})
.catch(err => {
console.error('Failed to copy URL:', err);
});
});
},
};