https://github.com/electron-utils/electron-platform
Platform detection for Electron, Web Browser and Node
https://github.com/electron-utils/electron-platform
electron platform-detection
Last synced: 2 months ago
JSON representation
Platform detection for Electron, Web Browser and Node
- Host: GitHub
- URL: https://github.com/electron-utils/electron-platform
- Owner: electron-utils
- License: mit
- Created: 2016-12-26T17:55:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-09T06:44:16.000Z (about 8 years ago)
- Last Synced: 2025-03-17T05:38:22.157Z (2 months ago)
- Topics: electron, platform-detection
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electron-platform
[](https://travis-ci.org/electron-utils/electron-platform)
[](https://ci.appveyor.com/project/jwu/electron-platform)
[](https://david-dm.org/electron-utils/electron-platform)
[](https://david-dm.org/electron-utils/electron-platform#info=devDependencies)Platform detection for Electron and Web Browser.
## Install
```bash
npm install --save electron-platform
```## Usage
```javascript
const platform = require('electron-platform');if ( platform.isRendererProcess ) {
// do something
}
```## API Reference
### Properties
#### isNode
Indicates whether executes in node.js application.
#### isElectron
Indicates whether executes in electron.
#### isNative
Indicates whether executes in native environment (compare to web-browser).
#### isPureWeb
Indicates whether executes in common web browser.
#### isRendererProcess
Indicates whether executes in common web browser, or editor's renderer process(web-page).
#### isMainProcess
Indicates whether executes in editor's main process.
#### isDarwin
Indicates whether executes in OSX.
#### isWin32
Indicates whether executes in Windows.
#### isDev
Check if running in retina display.
If we are in renderer process and `nodeIntegration` is false, isDev will be undefined.#### isRetina
Check if running in retina display.
## License
MIT © 2017 Johnny Wu