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.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @providesModule Clipboard
|
* @providesModule Clipboard
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'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
|
* `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
|
||||||
|
@ -24,14 +26,13 @@ module.exports = {
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
getString() {
|
getString(): Promise<string> {
|
||||||
if (arguments.length > 0) {
|
return deprecatedCallback(
|
||||||
let callback = arguments[0];
|
Clipboard.getString(),
|
||||||
console.warn('Clipboard.getString(callback) is deprecated. Use the returned Promise instead');
|
Array.prototype.slice.call(arguments),
|
||||||
Clipboard.getString().then(callback);
|
'success-first',
|
||||||
return;
|
'Clipboard.getString(callback) is deprecated. Use the returned Promise instead'
|
||||||
}
|
);
|
||||||
return Clipboard.getString();
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Set content of string type. You can use following code to set clipboard content
|
* 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.
|
* @param the content to be stored in the clipboard.
|
||||||
*/
|
*/
|
||||||
setString(content) {
|
setString(content: string) {
|
||||||
Clipboard.setString(content);
|
Clipboard.setString(content);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue