{"_id":"is-electron-renderer","_rev":"6-503c1c31c6e2a1b6bee398fb8fc3ae93","name":"is-electron-renderer","description":"Check if code is running in Electron renderer process.","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"is-electron-renderer","version":"1.0.0","description":"Check if code is running in Electron renderer process.","main":"index.js","scripts":{"test":"standard && mocha"},"repository":{"type":"git","url":"git+https://github.com/jprichardson/is-electron-renderer.git"},"keywords":["electron","electron-component","atom","renderer","process"],"author":{"name":"JP Richardson"},"license":"MIT","bugs":{"url":"https://github.com/jprichardson/is-electron-renderer/issues"},"homepage":"https://github.com/jprichardson/is-electron-renderer#readme","devDependencies":{"mocha":"2.x","standard":"4.x"},"gitHead":"6276351ba82677a2b946b714d6e3d82fee7b8fc3","_id":"is-electron-renderer@1.0.0","_shasum":"4f556fc8335ef9fc79219f50e5c427cb22a34d2e","_from":".","_npmVersion":"2.10.1","_nodeVersion":"2.1.0","_npmUser":{"name":"jprichardson","email":"jprichardson@gmail.com"},"maintainers":[{"name":"jprichardson","email":"jprichardson@gmail.com"}],"dist":{"shasum":"4f556fc8335ef9fc79219f50e5c427cb22a34d2e","tarball":"https://registry.npmjs.org/is-electron-renderer/-/is-electron-renderer-1.0.0.tgz","integrity":"sha512-Ush2x9U/zfjh8M2A0e3SXybxYx+eSaSBGYtV2HguVhNn1qc+8rsx6PWwJVHfNH0ECKFhcRqgT5DanSAOVsUz0w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFI9AVQGztwmIUKoMrYVsfhN3jzuuxaPYTXCoq/iGtJKAiAjg0GwzsP6hVv7SbHP9mgb4yBlBmJjTkVPWnPbSoD3Vw=="}]}},"2.0.0":{"name":"is-electron-renderer","version":"2.0.0","description":"Check if code is running in Electron renderer process.","main":"index.js","scripts":{"test":"standard && mocha"},"repository":{"type":"git","url":"git+https://github.com/jprichardson/is-electron-renderer.git"},"keywords":["electron","electron-component","atom","renderer","process"],"author":{"name":"JP Richardson"},"license":"MIT","bugs":{"url":"https://github.com/jprichardson/is-electron-renderer/issues"},"homepage":"https://github.com/jprichardson/is-electron-renderer#readme","devDependencies":{"mocha":"2.x","standard":"4.x"},"gitHead":"1506ae56d60100aea9842d46a8da7032b8fa7b5b","_id":"is-electron-renderer@2.0.0","_shasum":"4084257811f8e668665cad72d32329a820cc30f6","_from":".","_npmVersion":"2.10.1","_nodeVersion":"2.1.0","_npmUser":{"name":"jprichardson","email":"jprichardson@gmail.com"},"maintainers":[{"name":"jprichardson","email":"jprichardson@gmail.com"}],"dist":{"shasum":"4084257811f8e668665cad72d32329a820cc30f6","tarball":"https://registry.npmjs.org/is-electron-renderer/-/is-electron-renderer-2.0.0.tgz","integrity":"sha512-JyjT5GDtM4nflVpaHyPcI/Rnb2j9vbcmPrIBJ9YsUIGmz6TU3iKXonaTHbGzL16BZOANVYkXbXelYrfUK1nwKQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfXY/emsyCK4DlfOf+8UHX0rZubsJ1bDz3xJsyjRGadAIgE2mUZy7PGxgBpKNqbF9A0cmbK+DRM+u5B42Zg6x1LLY="}]}},"2.0.1":{"name":"is-electron-renderer","version":"2.0.1","description":"Check if code is running in Electron renderer process.","main":"index.js","scripts":{"test":"standard && mocha"},"repository":{"type":"git","url":"git+https://github.com/jprichardson/is-electron-renderer.git"},"keywords":["electron","electron-component","atom","renderer","process"],"author":{"name":"JP Richardson"},"license":"MIT","bugs":{"url":"https://github.com/jprichardson/is-electron-renderer/issues"},"homepage":"https://github.com/jprichardson/is-electron-renderer#readme","devDependencies":{"mocha":"2.x","standard":"4.x"},"gitHead":"20aa3f6ed1ff27839b0d13550ba3cc177c221b81","_id":"is-electron-renderer@2.0.1","_shasum":"a469d056f975697c58c98c6023eb0aa79af895a2","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.1.0","_npmUser":{"name":"jprichardson","email":"jprichardson@gmail.com"},"maintainers":[{"name":"jprichardson","email":"jprichardson@gmail.com"}],"dist":{"shasum":"a469d056f975697c58c98c6023eb0aa79af895a2","tarball":"https://registry.npmjs.org/is-electron-renderer/-/is-electron-renderer-2.0.1.tgz","integrity":"sha512-pRlQnpaCFhDVPtkXkP+g9Ybv/CjbiQDjnKFQTEjpBfDKeV6dRDBczuFRDpM6DVfk2EjpMS8t5kwE5jPnqYl3zA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH4efL60pFRbYOkiQAG1FCLZD5fj+eKtGVQzy7XnKelKAiEA8/Qe2MSIXBzBb8AmRfL9RoWU53lIkeI3iPUfITNXDs0="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/is-electron-renderer-2.0.1.tgz_1474814423019_0.5266153535339981"}}},"readme":"is-electron-renderer\n====================\n\nCheck if code is running in Electron `renderer` process.\n\nWhy?\n----\n\nElectron code can run in either the `main` process or\nthe `renderer` process. This is the same as asking if\nthe code is running in a web page with access to the\nDOM or not. Read more here: https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md\n\n### Use Cases:\n\n- Creating a single module that acts differently whether it's running in `main` or `renderer`.\n- Logging utility. One process (`main`) would be responsible for writing to log files, while\nrenderers would send log data to the `main`. Would allow your code to have one `log` method.\n- Testing. Your test code may behave differently if the DOM is available.\n- Normalize `console.log` behavior. `console.log` behavior is weird in `renderer`, this can easily be fixed.\n\n### Why Use a One Line Module?\n\nExcellent discussion here: https://github.com/sindresorhus/ama/issues/10. If that doesn't convince you,\nthen maybe the fact that Electron could change the way that they inherit `global` in `renderer` and\nif they do, you would have to change your code whereas if you used this module, you'd just have to update\nto the latest version =)\n\n\nInstall\n-------\n\n    npm i --save is-electron-renderer\n\n\nUsage\n-----\n\nYou'll notice that when using `console.log` in Electron that in the `renderer` process\noutputs some weird log level garbage to `stderr` before your actual console message.\nYou can normalize this behavior:\n\n**console-hook.js**:\n\n```js\n// clean up Electron output\nfunction hook () {\n  var isRenderer = require('is-electron-renderer')\n  var pre = '(' + (isRenderer ? 'RENDERER' : 'MAIN') + ') '\n  console.log = function (msg) {\n    process.stdout.write(pre + msg + '\\n')\n  }\n}\n\nmodule.exports = {\n  hook: hook\n}\n```\n\n**index.js**:\n\n```js\nrequire('./console-hook').hook()\nconsole.log('hello')\n```\n\noutput (main):\n\n    (MAIN) hello\n\noutput (renderer):\n\n    (RENDERER) hello\n\n\nAPI\n---\n\n```js\nvar isRenderer = require('is-electron-renderer')\nconsole.log(isRenderer)\n// => (BOOLEAN)\n```\n\nLicense\n-------\n\nMIT\n\nCopyright 2015 [JP Richardson](https://github.com/jprichardson)\n\n","maintainers":[{"name":"jprichardson","email":"jprichardson@gmail.com"}],"time":{"modified":"2022-06-19T02:40:09.044Z","created":"2015-07-04T16:06:22.014Z","1.0.0":"2015-07-04T16:06:22.014Z","2.0.0":"2015-07-14T15:17:23.646Z","2.0.1":"2016-09-25T14:40:24.244Z"},"homepage":"https://github.com/jprichardson/is-electron-renderer#readme","keywords":["electron","electron-component","atom","renderer","process"],"repository":{"type":"git","url":"git+https://github.com/jprichardson/is-electron-renderer.git"},"author":{"name":"JP Richardson"},"bugs":{"url":"https://github.com/jprichardson/is-electron-renderer/issues"},"license":"MIT","readmeFilename":"readme.md","users":{"ziflex":true}}