🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

gotem

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gotem

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

0.0.3
latest
Source
npm
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

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:

  • A required trigger node.
  • A required target node.
  • 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

Keywords

browser

FAQs

Package last updated on 03 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts