perf: migrate to tinyclip from clipboardy#39538
perf: migrate to tinyclip from clipboardy#39538florian-lefebvre wants to merge 2 commits intogatsbyjs:masterfrom
Conversation
|
cc @serhalp |
| if (`writeSync` in clipboardy) { | ||
| clipboardy.writeSync(response.data) | ||
| } |
There was a problem hiding this comment.
Any idea why this one was using the synchronous API and checking for method presence? 🤔
Because it wasn't available in the browser? https://main.npmx.dev/package/clipboardy#user-content-api
Does that apply in tinyclip? The readme says "In the browser, you can use the native Clipboard API instead of a dependency." Does that imply that tinyclip doesn't work in the browser? Does this code need to conditionally use the Clipboard API? 🤔
There was a problem hiding this comment.
I don't know why it was using a sync API. Clipboardy sync APIs are not available in the browser anyways: https://github.com/sindresorhus/clipboardy/blob/main/browser.js
So this change doesn't change anything to the current behavior. Now if this code can run in the browser, then yes it would first need checking if we're client side and call the Clipboard API. Let me know!
Description
Tinyclip is really lighter than clipboardy. This PR was made as part of the e18e initiative.
Followup to #39487
Documentation
N/A
Tests
N/A
Related Issues
N/A