UNPKG

@wider/utils_where-am-i

Version:

Determine where your code is running

135 lines (96 loc) 5.67 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Home | Wider</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-jsdoc.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/tui-doc.css"> </head> <body> <nav class="lnb" id="lnb"> <div class="logo" style="width: 50px"> <a href="https://y-d-r.co.uk" rel="noopener noreferrer" target="_blank"> <img src="https://y-d-r.co.uk/favicon.ico" width="100%" height="100%"> </a> </div> <div class="title"> <h1><a href="index.html" class="link">Wider</a></h1> <span class="version">v1.1.21</span> </div> <div class="search-container" id="search-container"> <input type="text" placeholder="Search"> <ul></ul> </div> <ol class="lnb-tab"> <li id="api-tab"> <a href="#"><h4>API</h4></a> </li> <li id="examples-tab"> <a href="#"><h4>Examples</h4></a> </li> </ol> <div class="lnb-examples hidden"><h3>Examples</h3><ul><li><a href="tutorial-Examples.html">Examples</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Examples_sub"></div></li></ul></div><div class="lnb-api hidden"><h3>Modules</h3><ul><li><a href="module-@wider_utils_where-am-i.html">@wider/utils_where-am-i</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="module:@wider/utils_where-am-i_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="module-@wider_utils_where-am-i.html#~whereAmI">whereAmI</a></li></ul><div class="member-type">Typedef</div><ul class="inner"><li><a href="module-@wider_utils_where-am-i.html#~whereAmI_result">whereAmI_result</a></li></ul></div></li></ul></div> </nav> <div id="resizer"></div> <div class="main" id="main"> <section> <article class="readme"><h1>@wider/utils_where-am-i YDR Utilities - Where am I?</h1> <h2>Introduction</h2> <p>Disclose where your code is running</p> <p>A javascript tool that investigates and reports on the environment in which it is running. Presently coded for nodejs, browsers and various windows environments such as WScript or ASPclassic. It will report &quot;unknown&quot; for environments that the author does not have access tp test.</p> <p>There are no dependencies.</p> <h2>Documentation</h2> <p><a href="https://ydr-co.uk/packages/@wider/utils_where-am-i/index.html">Full Documentation</a></p> <h2>Install</h2> <pre class="prettyprint source lang-command"><code>npm install &quot;@wider/utils_where-am-i&quot; </code></pre> <h2>Use</h2> <pre class="prettyprint source lang-javascript"><code>// from ES MOdule import { genre, os, engine, version, _genres } from &quot;@wider/utils_where-am-i/index.js&quot;; // from commonJS module const { genre, os, engine, version, _genres } = require (&quot;@wider/utils_where-am-i&quot;); // from non-module environments yourLinkOrImportMethod(&quot;a/path/to/@wider/utils_where-am-i/index.js) var where = whereAmI(); </code></pre> <p>The code in this package has been written deliberately in an early dialect of javascript so that identical code can run on legacy environments by just loading the file <code>./index.js</code> which then exposes the <code>whereAmI()</code> method. This generates a simple object with the same properties that are exported in the node environment.</p> <p>See the <a href="./tutorial-Examples.html">Example</a> for the earliest versions of supported environments.</p> <h2>Documentation and Example Results</h2> <p>On <a href="https://www.npmjs.com/package/@wider/utils_where-am-i">npm</a>, you can run this in <strong>RunKit</strong> and see the details for the linux server that runs npm. Typically that will return</p> <pre class="prettyprint source lang-javascript"><code>{ _genres: /unknown|server|browser|script/, genre: &quot;server&quot;, engine: &quot;node&quot;, version: &quot;v14.17.4&quot;, computerName: &quot;YDR-HP-2015&quot; os: &quot;linux&quot; } </code></pre> <p>Developer documentation and examples are available at <a href="http://y-d-r.co.uk/packages/@wider/utils_where-am-i/index.html">the @wider website</a></p></article> </section> </div> <footer> <img class="logo" src="https://y-d-r.co.uk/favicon.ico" style="width: 50px"> <div class="footer-text">Copyright Martin Baker 1985 onwards - ISC License</div> </footer> <script>prettyPrint();</script> <script src="scripts/jquery.min.js"></script> <script src="scripts/tui-doc.js"></script> <script src="scripts/linenumber.js"></script> <script> var id = 'package:@wider/utils_where-am-i_sub'.replace(/"/g, '_'); var selectedApi = document.getElementById(id); // do not use jquery selector var $selectedApi = $(selectedApi); $selectedApi.removeClass('hidden'); $selectedApi.parent().find('.glyphicon').removeClass('glyphicon-plus').addClass('glyphicon-minus'); showLnbApi(); </script> </body> </html>