Closed frdmn closed 9 years ago
Hi @frdmn the callback function has two parameters. The first should contain the Error if one ocurred. The second parameter ist the Clipboard-data.
this should work:
var clipboard = require('copy-paste');
function getClipboard(cb){
clipboard.paste(function(err, data){
if(err) { return cb(false); }
return cb(data);
});
}
getClipboard(function(data){
console.log(data);
})
Thanks @HerrZatacke. @frdmn is 100% correct. Hope that helps.
@HerrZatacke @xavi- Ah this makes sense, thanks a lot!
When I try to use
paste()
with it's callback function, it always returns withnull
. Here's an example:Without the callback it works just fine: