mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Make the function callback friendly.
This commit is contained in:
parent
f6821781d2
commit
24a55cf777
@ -19,13 +19,13 @@ class ExtensionPlatform {
|
|||||||
|
|
||||||
getPlatformInfo (cb) {
|
getPlatformInfo (cb) {
|
||||||
try {
|
try {
|
||||||
return extension.runtime.getPlatformInfo(cb)
|
extension.runtime.getPlatformInfo((platform) => {
|
||||||
|
cb(null, platform)
|
||||||
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.debug(e)
|
cb(e)
|
||||||
return undefined
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ExtensionPlatform
|
module.exports = ExtensionPlatform
|
||||||
|
@ -113,8 +113,12 @@ ConfigScreen.prototype.render = function () {
|
|||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
},
|
},
|
||||||
onClick (event) {
|
onClick (event) {
|
||||||
window.logStateString((result) => {
|
window.logStateString((err, result) => {
|
||||||
exportAsFile('MetaMask State Logs', result)
|
if (err) {
|
||||||
|
state.dispatch(actions.displayWarning('Error in retrieving state logs.'))
|
||||||
|
} else {
|
||||||
|
exportAsFile('MetaMask State Logs', result)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}, 'Download State Logs'),
|
}, 'Download State Logs'),
|
||||||
|
@ -45,12 +45,15 @@ window.logStateString = function (cb) {
|
|||||||
let state = window.METAMASK_CACHED_LOG_STATE
|
let state = window.METAMASK_CACHED_LOG_STATE
|
||||||
const version = global.platform.getVersion()
|
const version = global.platform.getVersion()
|
||||||
const browser = window.navigator.userAgent
|
const browser = window.navigator.userAgent
|
||||||
return global.platform.getPlatformInfo((platform) => {
|
return global.platform.getPlatformInfo((err, platform) => {
|
||||||
|
if (err) {
|
||||||
|
return cb(err)
|
||||||
|
}
|
||||||
state.version = version
|
state.version = version
|
||||||
state.platform = platform
|
state.platform = platform
|
||||||
state.browser = browser
|
state.browser = browser
|
||||||
let stateString = JSON.stringify(state, removeSeedWords, 2)
|
let stateString = JSON.stringify(state, removeSeedWords, 2)
|
||||||
return cb(stateString)
|
return cb(null, stateString)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user