mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
Annotate Clipboard module
Reviewed By: svcscm Differential Revision: D2866837 fb-gh-sync-id: 0f7da139e1296aec6a518d52056a6d0a1b9c07ca shipit-source-id: 0f7da139e1296aec6a518d52056a6d0a1b9c07ca
This commit is contained in:
parent
51a8b54015
commit
46a8f1d8e0
@ -7,10 +7,12 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule Clipboard
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var Clipboard = require('NativeModules').Clipboard;
|
||||
const Clipboard = require('NativeModules').Clipboard;
|
||||
const deprecatedCallback = require('deprecatedCallback');
|
||||
|
||||
/**
|
||||
* `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
|
||||
@ -24,14 +26,13 @@ module.exports = {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
getString() {
|
||||
if (arguments.length > 0) {
|
||||
let callback = arguments[0];
|
||||
console.warn('Clipboard.getString(callback) is deprecated. Use the returned Promise instead');
|
||||
Clipboard.getString().then(callback);
|
||||
return;
|
||||
}
|
||||
return Clipboard.getString();
|
||||
getString(): Promise<string> {
|
||||
return deprecatedCallback(
|
||||
Clipboard.getString(),
|
||||
Array.prototype.slice.call(arguments),
|
||||
'success-first',
|
||||
'Clipboard.getString(callback) is deprecated. Use the returned Promise instead'
|
||||
);
|
||||
},
|
||||
/**
|
||||
* Set content of string type. You can use following code to set clipboard content
|
||||
@ -42,7 +43,7 @@ module.exports = {
|
||||
* ```
|
||||
* @param the content to be stored in the clipboard.
|
||||
*/
|
||||
setString(content) {
|
||||
setString(content: string) {
|
||||
Clipboard.setString(content);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user