🎨 Assign binding as const
This commit is contained in:
parent
1278e8cebc
commit
d6d85ade8e
1 changed files with 4 additions and 2 deletions
|
@ -1,11 +1,13 @@
|
||||||
const timers = require('timers')
|
const timers = require('timers')
|
||||||
|
|
||||||
|
const {binding} = process
|
||||||
|
|
||||||
process.atomBinding = function (name) {
|
process.atomBinding = function (name) {
|
||||||
try {
|
try {
|
||||||
return process.binding(`atom_${process.type}_${name}`)
|
return binding(`atom_${process.type}_${name}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (/No such module/.test(error.message)) {
|
if (/No such module/.test(error.message)) {
|
||||||
return process.binding(`atom_common_${name}`)
|
return binding(`atom_common_${name}`)
|
||||||
} else {
|
} else {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue