2019-03-08 18:29:52 +00:00
|
|
|
export function atomBindingSetup (binding: typeof process['_linkedBinding'], processType: typeof process['type']): typeof process['atomBinding'] {
|
2019-02-12 14:22:33 +00:00
|
|
|
return function atomBinding (name: string) {
|
2017-02-20 13:59:39 +00:00
|
|
|
try {
|
|
|
|
return binding(`atom_${processType}_${name}`)
|
|
|
|
} catch (error) {
|
|
|
|
if (/No such module/.test(error.message)) {
|
|
|
|
return binding(`atom_common_${name}`)
|
|
|
|
} else {
|
|
|
|
throw error
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|