mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-10-30 15:33:11 +05:30
17 lines
403 B
TypeScript
17 lines
403 B
TypeScript
import copyToClipboard from 'copy-to-clipboard';
|
|
|
|
/**
|
|
* Simple wrapper to copy-to-clipboard library, that adds support
|
|
* for the new navigator.clipboard API.
|
|
*
|
|
* @param {string} content
|
|
* @returns {Promise<*>}
|
|
*/
|
|
export default async function copy(content: string): Promise<void> {
|
|
if (navigator.clipboard) {
|
|
return navigator.clipboard.writeText(content);
|
|
}
|
|
|
|
copyToClipboard(content);
|
|
}
|