Copy text to clipboard using execCommand('copy') on Web browser
npm install exec-copyCopy text to clipboard using execCommand('copy') on Web browser.
- https://github.com/shokai/exec-copy
- https://npmjs.com/package/exec-copy

``javascript
var execCopy = require('exec-copy')
button.addEventListener('click', function (e) {
execCopy('this is copied text!!')
})
`
Some browser (e.g. Safari) doesnot have execCommand('copy'). For fallback, This library automatically open window.prompt.
Also you can overwrite fallback if you need.
`javascript`
execCopy('this is copied text!!', function (str) {
// do something when execCommand('copy') is not available
})
- https://shokai.github.io/exec-copy/sample/
build sample code (./sample/source.js)
% npm install
% npm run build
open ./sample/index.html`