asarfuckery/electronasar/development/common/atom-binding-setup.js

16 lines
356 B
JavaScript
Raw Normal View History

2019-01-17 18:22:05 +00:00
'use strict'
module.exports = function atomBindingSetup (binding, processType) {
return function atomBinding (name) {
try {
return binding(`atom_${processType}_${name}`)
} catch (error) {
if (/No such module/.test(error.message)) {
return binding(`atom_common_${name}`)
} else {
throw error
}
}
}
}