我有以下代码将大约25MB的数据复制到剪贴板:
// star time after populating HTML and Text
const start_time = new Date().getTime();
navigator.clipboard.write([
new ClipboardItem({
"text/html": new Blob([html], {
type: "text/html",
}),
"text/plain": new Blob([text], {
type: "text/plain",
}),
}),
]).then(() => {
// end time after async clipbaord api method is completed
const end_time = new Date().getTime();
console.log("writing to clipboard : DONE in", (end_time - start_time) / 1000, "s");
});
这需要 45 秒!
clipboard.write(...)
为什么要执行这么长时间?有没有一些方法可以改进这个问题呢?或者说它不适用于复制大量数据?