1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Add option to copy directly to clipboard.

This commit is contained in:
Kevin Serrano 2017-10-26 16:40:13 -07:00
parent c89ea954e5
commit 3deeb6df0b
No known key found for this signature in database
GPG Key ID: BF999DEFC7371BA1

View File

@ -1,4 +1,5 @@
const extend = require('xtend')
const copyToClipboard = require('copy-to-clipboard')
//
// Sub-Reducers take in the complete state and return their sub-state
@ -57,9 +58,16 @@ window.logStateString = function (cb) {
})
}
window.logState = function () {
return window.logStateString((result) => {
console.log(result)
window.logState = function (toClipboard) {
return window.logStateString((err, result) => {
if (err) {
console.error(err.message)
} else if (toClipboard) {
copyToClipboard(result)
console.log('State log copied')
} else {
console.log(result)
}
})
}