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