webcom-reach
Version:
Create apps using WebRTC with Webcom
174 lines (173 loc) • 6.41 kB
HTML
<html lang="en">
<head>
<title>Code coverage report for src/definitions/Browser.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">src/definitions/</a> Browser.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">76.92% </span>
<span class="quiet">Statements</span>
<span class='fraction'>10/13</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">52.94% </span>
<span class="quiet">Branches</span>
<span class='fraction'>9/17</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">76.92% </span>
<span class="quiet">Lines</span>
<span class='fraction'>10/13</span>
</div>
</div>
</div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import {browserDetails, browserShim} from 'webrtc-adapter';
import Webcom from 'webcom/webcom';
/**
* The current browser's infos
* @typedef {Object} Browser
* @property {string} name - current browser's name
* @property {number} [version] - current browser's version
* @property {number} [minVersion] - current browser's minimum supported version
* @property {boolean} compatible - is current browser supported ?
*/
export const browser = Object.assign({
compatible: !/\s/.test(browserDetails.browser) &&
(!browserDetails.minVersion || <span class="branch-2 cbranch-no" title="branch not covered" >browserDetails.version >= browserDetails.minVersion)</span>
}, browserDetails);
const version = `Reach v${SDK_VERSION} | Schema ${SCHEMA_VERSION} | Webcom v${Webcom.SDK_VERSION}`;
let message = '';
<span class="missing-if-branch" title="if path not taken" >I</span>if(browser.version === null) {
<span class="cstat-no" title="statement not covered" > message = 'Unsupported browser: browser must support WebRTC Peer-to-peer connections to use Reach';</span>
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (browser.minVersion && <span class="branch-1 cbranch-no" title="branch not covered" >browser.minVersion > browser.version)</span> {
<span class="cstat-no" title="statement not covered" > message = `Unsupported browser: browser is outdated, update to latest version (${browser.minVersion}+)`;</span>
} else <span class="missing-if-branch" title="if path not taken" >I</span>if(!browserShim){
<span class="cstat-no" title="statement not covered" > message = 'No shim for your browser. There might a problem with your package.';</span>
}
// Log browser status & SDKs versions on load
let args = [`${version} ${message}`];
<span class="missing-if-branch" title="else path not taken" >E</span>if(/^(chrome|firefox)$/.test(browser.browser)) {
args = [
`%c ${version} %c ${message}`,
`background: ${browser.compatible ? '#f50' : <span class="branch-1 cbranch-no" title="branch not covered" >'red'}</span>; color: #fff; font-weight: bold`,
`color: ${browser.compatible ? 'inherit' : <span class="branch-1 cbranch-no" title="branch not covered" >'red'}</span>`
];
}
console.log(...args);
</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Oct 11 2017 13:49:15 GMT+0000 (UTC)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>