2018-09-22 12:28:50 +00:00
|
|
|
'use strict'
|
|
|
|
|
2017-02-20 13:59:39 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|