Add some docs to the code. Work in progress

This commit is contained in:
mmcwilliams 2019-02-26 21:53:32 -05:00
parent bc9e882a37
commit a9dd45a464
6 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<a name="exit"></a>
## exit(msg, code)
Exit process with either a 0 code or other
specified failure code. Print message to console first.
**Kind**: global function
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| msg | <code>string</code> | | Reason for exit |
| code | <code>integer</code> | <code>0</code> | process exit code, default 0 |

View File

@ -1,5 +1,13 @@
'use strict';
/**
* Exit process with either a 0 code or other
* specified failure code. Print message to console first.
*
* @param {string} msg Reason for exit
* @param {integer} code process exit code, default 0
**/
function exit (msg, code = 0) {
if (code === 0) {
console.log(msg);

View File

@ -0,0 +1,7 @@
<a name="spawn"></a>
## spawn()
Wrapper function around spawn that prints to console
after process closes. Not used.
**Kind**: global function

View File

@ -2,6 +2,10 @@
const spawnRaw = require('child_process').spawn;
/**
* Wrapper function around spawn that prints to console
* after process closes. Not used.
**/
function spawn (cmd, args) {
const sp = spawnRaw(cmd, args);
let output = '';

View File

@ -0,0 +1,37 @@
## Functions
<dl>
<dt><a href="#dependencies">dependencies(platform)</a></dt>
<dd><p>Evaluates system dependencies for digital
projector features by executing processes with
--help flag. If they do not exist, log to console</p>
</dd>
<dt><a href="#system">system()</a><code>object</code></dt>
<dd><p>Profile the current system and return an object with
data about the displays and dependencies for the digital
projector feature.</p>
</dd>
</dl>
<a name="dependencies"></a>
## dependencies(platform)
Evaluates system dependencies for digital
projector features by executing processes with
--help flag. If they do not exist, log to console
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| platform | <code>string</code> | Operating system type |
<a name="system"></a>
## system() ⇒ <code>object</code>
Profile the current system and return an object with
data about the displays and dependencies for the digital
projector feature.
**Kind**: global function
**Returns**: <code>object</code> - Object containing system information

View File

@ -7,6 +7,14 @@ const exec = require('exec');
//const spawn = require('spawn');
//const exit = require('exit');
/**
* Evaluates system dependencies for digital
* projector features by executing processes with
* --help flag. If they do not exist, log to console
*
* @param {string} platform Operating system type
**/
async function dependencies (platform) {
let obj = {};
@ -31,6 +39,13 @@ async function dependencies (platform) {
return obj;
}
/**
* Profile the current system and return an object with
* data about the displays and dependencies for the digital
* projector feature.
*
* @returns {object} Object containing system information
*/
async function system () {
const obj = {};
let displays = electron.screen.getAllDisplays();