UNPKG

@wider/utils_where-am-i

Version:

Determine where your code is running

493 lines (179 loc) 9.77 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Module: @wider/utils_where-am-i | 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> <header> <h2>@wider/utils_where-am-i</h2> </header> <article> <div class="container-overview"> </div> <h3 class="subsection-title">Methods</h3> <dl> <dt> <h4 class="name" id="~whereAmI"> <span class="type-signature"><span class="icon green">inner</span> </span>whereAmI<span class="signature">()</span><span class="type-signature"> &rarr; {whereAmI_result}</span> <div class="container-source members"> <code><a href="index.js.html">index.js</a></code>, <code><a href="index.js.html#line42">line 42</a></code> </div> </h4> </dt> <dd> <div class="description"> <p>Provide a standard json object response that indicates to the caller the nature of the environment on which it is running</p> <p>This can be required or imported and the result is a plain javascript object.</p> <p>See <a href="/./tutorial-Examples.html">Examples</a> for the JSON objects returned.</p> </div> <div class="container-returns"> <h5>Returns:</h5> <span class="param-type">whereAmI_result</span> </div> <dl class="details"> </dl> </dd> </dl> <h3 class="subsection-title">Type Definitions</h3> <dl> <dt> <h4 class="name" id="~whereAmI_result"> whereAmI_result <div class="container-source members"> <code><a href="index.js.html">index.js</a></code>, <code><a href="index.js.html#line18">line 18</a></code> </div> </h4> </dt> <dd> <div class="description"> <p>The structure of the object returned by this module.</p> <p>In the event that any of these properties cannot be determined, they will contain the value <code>unknown</code></p> <p>Please feed back to us additional environments or values we might also detect</p> </div> <!-- <h5>Type:</h5> <ul> <li> <span class="param-type">Object</span> </li> </ul> --> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>_genres</code></td> <td class="type"> <span class="param-type">RegExp</span> </td> <td class="description last"><p>a regular expression that returns true when testing against a string that contains any one of the possible values of <code>genre</code></p></td> </tr> <tr> <td class="name"><code>genre</code></td> <td class="type"> <span class="param-type">NCName</span> </td> <td class="description last"><p>the genre or general category of processor engine of the environment on which the code is running. This version will contain one of the following <code>[&quot;unknown&quot;, &quot;server&quot;, &quot;browser&quot;, &quot;script&quot;]</code></p></td> </tr> <tr> <td class="name"><code>engine</code></td> <td class="type"> <span class="param-type">NCName</span> </td> <td class="description last"><p>the engine that is running the code at the moment. This may contain various values as reported by the engine about itself. Some values include <code>[&quot;unknown&quot;, &quot;node&quot;, &quot;Firefox&quot;, &quot;Edg&quot;, &quot;Chrome&quot;, &quot;Trident&quot;,&quot;WScript&quot;, &quot;aspClassic&quot;]</code></p></td> </tr> <tr> <td class="name"><code>version</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>the version of the engine in the format that is used by that engine</p></td> </tr> <tr> <td class="name"><code>os</code></td> <td class="type"> <span class="param-type">NCName</span> </td> <td class="description last"><p>the name of the operating system coerced to lower case. Some values include <code>[&quot;unknown&quot;, &quot;linux&quot;, &quot;sunos&quot;, &quot;openbsd&quot;, &quot;freebsd&quot;, &quot;darwin&quot;, &quot;aix&quot;, &quot;win16&quot;, &quot;win32&quot;, &quot;win64&quot;]</code>.<br> Important - nodejs reports <code>win32</code> even when on a 64 bit machine with 64 bit os. The value responded here is the true version of the operating system so on node on a 64 window machine AND with 64 bit os you get <em><strong>win64</strong></em> just as you would on a windows script running on the same machine</p></td> </tr> <tr> <td class="name"><code>computerName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>the name of the computer on which your code is running. This is not discoverable in all environments</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> </dl> </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 = 'module:@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>