xe-command
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

xe-command

npm version npm build npm downloads npm license

XECommand 使用原生js实现复制文本到剪贴板的函数,支持常用H5的浏览器IE、Chrome、Firefox、Opera、Safari、IOS、Android,压缩后还不到1KB的轻量级copy函数

Browser Support

IE Edge Chrome Firefox Opera Safari
10+ ✔ Latest ✔ Latest ✔ 41+ ✔ 29+ ✔ 10+ ✔

Installing

npm install xe-command --save
import XECommand from 'xe-command'
<script src="https://cdn.jsdelivr.net/npm/xe-command/dist/xe-command.js"></script>
<script src="https://unpkg.com/xe-command/dist/xe-command.js"></script>

Example

import XECommand from 'xe-command'
 
document.querySelector('.button').addEventListener('click', evnt => {
  if (XECommand.copy('Copy this content to the clipboard')) {
    alery('Copy success.')
  } else {
    alert('The browser is not supported.')
  }
})

License

Copyright (c) 2017-present, Xu Liangzhan

Package Sidebar

Install

npm i xe-command

Weekly Downloads

7

Version

1.1.3

License

MIT

Unpacked Size

8.42 kB

Total Files

7

Last publish

Collaborators

  • x-extends