mirror of
https://github.com/electron/electron.git
synced 2026-01-29 09:18:18 -05:00
26 lines
533 B
JavaScript
26 lines
533 B
JavaScript
'use strict'
|
|
|
|
const { remote } = require('electron')
|
|
|
|
exports.getRemote = function (name) {
|
|
if (!remote) {
|
|
throw new Error(`${name} requires remote, which is not enabled`)
|
|
}
|
|
return remote[name]
|
|
}
|
|
|
|
exports.remoteRequire = function (name) {
|
|
if (!remote) {
|
|
throw new Error(`${name} requires remote, which is not enabled`)
|
|
}
|
|
return remote.require(name)
|
|
}
|
|
|
|
exports.potentiallyRemoteRequire = function (name) {
|
|
if (process.sandboxed) {
|
|
return exports.remoteRequire(name)
|
|
} else {
|
|
return require(name)
|
|
}
|
|
}
|