Need help with gotem?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

callmecavs
439 Stars 12 Forks 16 Commits 2 Opened issues

Description

Copy to clipboard for modern browsers in less than 1kb.

Services available

!
?

Need anything else?

Contributors list

# 18,257
CSS
HTML
masonry
Shell
14 commits
# 110,789
Arduino
Node.js
Markdow...
Sass
1 commit

gotem

gotem on NPM Standard JavaScript Style

Copy to clipboard for modern browsers in less than 1kb.

Install

$ npm i gotem --save

Use

gotem
is a function that accepts 3 parameters:
  1. A required trigger node.
  2. A required target node.
  3. An optional object of callback functions.

Examples follow:

import gotem from 'gotem'

// a trigger and target node are required const nodes = { trigger: document.getElementById('trigger'), target: document.getElementById('target') }

// when the trigger is clicked, // the text of the target will be copied to the clipboard gotem(nodes.trigger, nodes.target)

// if an object with callback functions (success, error) is passed, // the appropriate function, based on the result of executing the copy command, will be fired if it exists gotem(nodes.trigger, nodes.target, { success: () => console.log('Copy command succeeded'), error: () => console.log('Copy command failed, BUT the text to copy has still been selected.') })

Browser Support

gotem requires

execCommand
cut/copy support.

As such, it works in the following:

  • Chrome 43+
  • Firefox 41+
  • Safari 10+
  • Edge 12+
  • IE 9+

License

MIT. © 2017 Michael Cavalea

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.