mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-05-19 13:26:37 +00:00
fix: fs shim electron check
This commit is contained in:
parent
80fdf57cbe
commit
651d793e31
@ -1,4 +1,17 @@
|
||||
/* eslint-disable */
|
||||
const fs = (typeof process !== 'object' && (typeof window === 'object' || typeof self === 'object')) ? null : eval('require("fs")')
|
||||
// adapted from https://github.com/cheton/is-electron - (c) Cheton Wu
|
||||
const isElectron = () => {
|
||||
if (typeof window !== 'undefined' && typeof window.process === 'object') {
|
||||
return true
|
||||
}
|
||||
|
||||
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
const fs = (!isElectron() && (typeof window === 'object' || typeof self === 'object')) ? null : eval('require("fs")')
|
||||
|
||||
module.exports = fs
|
||||
|
Loading…
x
Reference in New Issue
Block a user