1.3.0 • Published 6 years ago

execcommand-copy v1.3.0

Weekly downloads
44
License
ISC
Repository
github
Last release
6 years ago

execcommand-copy

Copy text to a user's clipboard using the modern execCommand interface. This uses the same browser API - document.execCommand as the much-hyped clipboard.js, but doesn't involve itself in the DOM or event binding.

API

available

Detect whether a browser supports the execCommand interface for copying text.

Returns boolean whether the browser support text

copy

Copy a snippet of text to a user's pasteboard if the user has proper browser support.

Parameters

  • text string text snippet

Examples

// using browser events with a click
var eCopy = require('execcommand-copy');
var a = document.getElementById('mybutton');
a.addEventListener('click', function() {
 eCopy.copy(this.innerHTML);
});

Returns boolean whether the text was copied

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

7 years ago

1.0.1

9 years ago

1.0.0

9 years ago