atom-binding-setup.ts 441 B

12345678910111213
  1. export function electronBindingSetup (binding: typeof process['_linkedBinding'], processType: typeof process['type']): typeof process['electronBinding'] {
  2. return function electronBinding (name: string) {
  3. try {
  4. return binding(`atom_${processType}_${name}`)
  5. } catch (error) {
  6. if (/No such module/.test(error.message)) {
  7. return binding(`atom_common_${name}`)
  8. } else {
  9. throw error
  10. }
  11. }
  12. }
  13. }