mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-24 01:39:06 +01:00
14 lines
322 B
JavaScript
14 lines
322 B
JavaScript
|
/**
|
||
|
* Clipboardに値をコピー(TODO: 文字列以外も対応)
|
||
|
*/
|
||
|
module.exports = val => {
|
||
|
const form = document.createElement('textarea');
|
||
|
form.textContent = val;
|
||
|
document.body.appendChild(form);
|
||
|
form.select();
|
||
|
const result = document.execCommand('copy');
|
||
|
document.body.removeChild(form);
|
||
|
|
||
|
return result;
|
||
|
};
|