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) {
|
||||
try {
|
||||
return extension.runtime.getPlatformInfo(cb)
|
||||
extension.runtime.getPlatformInfo((platform) => {
|
||||
cb(null, platform)
|
||||
})
|
||||
} catch (e) {
|
||||
log.debug(e)
|
||||
return undefined
|
||||
cb(e)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = ExtensionPlatform
|
||||
|
@ -113,8 +113,12 @@ ConfigScreen.prototype.render = function () {
|
||||
alignSelf: 'center',
|
||||
},
|
||||
onClick (event) {
|
||||
window.logStateString((result) => {
|
||||
exportAsFile('MetaMask State Logs', result)
|
||||
window.logStateString((err, result) => {
|
||||
if (err) {
|
||||
state.dispatch(actions.displayWarning('Error in retrieving state logs.'))
|
||||
} else {
|
||||
exportAsFile('MetaMask State Logs', result)
|
||||
}
|
||||
})
|
||||
},
|
||||
}, 'Download State Logs'),
|
||||
|
@ -45,12 +45,15 @@ window.logStateString = function (cb) {
|
||||
let state = window.METAMASK_CACHED_LOG_STATE
|
||||
const version = global.platform.getVersion()
|
||||
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.platform = platform
|
||||
state.browser = browser
|
||||
let stateString = JSON.stringify(state, removeSeedWords, 2)
|
||||
return cb(stateString)
|
||||
return cb(null, stateString)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user