detect-process
Detect if the running process context is nodejs
, phantomjs
, electron
, or browser
. Then you can create scripts that e.g. runs both in e.g. electron and the browser. Or at least find a way to determine which elements you will need to include, depending on the context.
Usage in nodejs:
var detect = ; var env = detect; console; // => nodejs, phantom, electron or browser
Usage in a browser:
Example in phantomjs:
var filename = './dist/detectProcess.js';injected = phantom;if injected var process = detectProcess; console; // => phantomjs phantom;
License MIT