Spy On Clipboard Copy Method Call

1 ยท Gleb Bahmutov ยท Nov. 22, 2022, 2:38 a.m.
Summary
Let's take an example application that copies some text to the system clipboard when the user clicks a button.๐ŸŽ You can find the source code for this blog post in the repo bahmutov/test-api-example.The application code for that button formats the string and calls the clipboard.writeText browser API method.app.js12345678910async copyTodos({ state }) { const markdown = state.todos .map((todo) => { const mark = todo.completed ? 'x' : ' ' return `- [${mark}] ${todo.title}` ...