Skip to content
Permalink
Browse files

Change the js signature to be Promise based and dynamically detect it…

… used as a callback

Summary:
Making the default people see when they look at the module the Promise based version

public

Reviewed By: davidaurelio

Differential Revision: D2850048

fb-gh-sync-id: e0815983ed798c202047cb071e65ce63a52fd1af
  • Loading branch information...
Dave Miller facebook-github-bot-7
Dave Miller authored and facebook-github-bot-7 committed Jan 21, 2016
1 parent c888e65 commit 747be0bf5cd1f9953312c40e3099b5eb0a58de08
Showing with 5 additions and 4 deletions.
  1. +2 −1 Examples/UIExplorer/ClipboardExample.js
  2. +3 −3 Libraries/Components/Clipboard/Clipboard.js
@@ -28,6 +28,7 @@ var ClipboardExample = React.createClass({
content: 'Content will appear here'
};
},

async _setClipboardContent(){
Clipboard.setString('Hello World');
try {
@@ -36,8 +37,8 @@ var ClipboardExample = React.createClass({
} catch (e) {
this.setState({content:e.message});
}

},

render() {
return (
<View>
@@ -23,10 +23,10 @@ module.exports = {
* var content = await Clipboard.getString();
* }
* ```
* @param this parameter is deprecated. callback is function with one argument of string type
*/
getString(callback) {
if (callback) {
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;

1 comment on commit 747be0b

@mkonicek

This comment has been minimized.

Copy link
Contributor

commented on 747be0b Jan 21, 2016

Nice! 👍

Please sign in to comment.
You can’t perform that action at this time.