1.0.5 • Published 4 years ago

clipboard-utility v1.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Clipboard utility

Build Status Maintainability Coverage Status

It's a utility to proceed with text copy in a browser.
It's LESS than 1KB and NO DEPENDENCIES.

Check below for more details.

Release notes

If something has stopped working and you probably did update of package recently, consider checking out our releases and changes between them.

Check out available markups across all the versions in our wiki.

Installation

npm i clipboard-utility --save

How to use

1st scenario

const copy = require('clipboard-utility')`
const text = copy('something to be copied!')

text -> { success: true, value: 'something to be copied!' }

2nd scenario

const copy = require('clipboard-utility')`
const text = copy('something to be copied!', ({ success, value }) => {
  if (!success) {
    // early quit
  }

  // e.g
  history.push({ pathname: value })
})

In both scenarios, value is placed in a CLIPBOARD .

Response

As a result of copy operation we are going to get an object as response.

Types

success
Returned when copy execution is proceeded flawlessly.

{
  sucess: false,
  value: 'Message that actually has been copied'
}

error
Returned when copy execution has failed at some point.

{
  type: false,
  value: 'Error message that has been thrown'
}
1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago