1.0.9 • Published 3 years ago

@uni/clipboard v1.0.9

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
3 years ago

getClipboard

npm

Install

$ npm install @uni/clipboard --save

or

$ npm install @uni/apis --save

Usage

import { getClipboard } from '@uni/clipboard';

getClipboard({
  success (res){
    console.log(res.text);
  }
});

// promise
getClipboard().then(res => {
  console.log(res.text);
});

Methods

getClipboard()

Gets the content on the system clipboard.

Supported

Arguments

PropertyTypeDescriptionrequiredDefault
optionsobject ✔️-
options.successFunction The callback function for a successful API call-
options.failFunction The callback function for a failed API call-
options.completeFunction The callback function used when the API call completed (always executed whether the call succeeds or fails)-

Return

PropertyTypeDescription
resobject
res.textstringThe clipboard content

setClipboard

Sets the content on the system clipboard.

Supported

Usage

import { setClipboard } from '@uni/clipboard';

setClipboard({
  text: 'text',
  success (res){
    console.log(res);
  }
});

// promise
setClipboard({
  text: 'text'
}).then(res => {
  console.log(res);
});

Arguments

PropertyTypeDescriptionrequiredDefault
optionsobject✔️-
options.textstringThe clipboard content✔️-
options.successFunction The callback function for a successful API call-
options.failFunction The callback function for a failed API call-
options.completeFunction The callback function used when the API call completed (always executed whether the call succeeds or fails)-