5afb7dc715
* refactor: load electron builtin modules with process._linkedBinding NODE_BUILTING_MODULE_CONTEXT_AWARE and process.binding are removed in https://github.com/nodejs/node/pull/25829. This changes uses the alternative available without any functionality change. * chore: roll node
13 lines
429 B
TypeScript
13 lines
429 B
TypeScript
export function atomBindingSetup (binding: typeof process['_linkedBinding'], processType: typeof process['type']): typeof process['atomBinding'] {
|
|
return function atomBinding (name: string) {
|
|
try {
|
|
return binding(`atom_${processType}_${name}`)
|
|
} catch (error) {
|
|
if (/No such module/.test(error.message)) {
|
|
return binding(`atom_common_${name}`)
|
|
} else {
|
|
throw error
|
|
}
|
|
}
|
|
}
|
|
}
|