adds getVersionInfo api (#91)

* adds getVersionInfo api

* fix mixed up names
This commit is contained in:
Lynn 2017-05-18 10:02:29 -07:00 committed by GitHub
parent a64053823b
commit c851c7b886
2 changed files with 29 additions and 3 deletions

View File

@ -57,7 +57,13 @@
<p>Get Media Sources:</p>
<button id='get-sources'>get entire desktop</button>
<br>
<video id='video'/>
<video id='video'></video>
<hr>
<p>Get Version Info:</p>
<button id='get-version'>get version info</button>
<br>
Version Info:<span id='info'></span>
</body>
<script>
var notfEl = document.getElementById('notf');
@ -187,6 +193,15 @@
console.log(e)
}
var getSources = document.getElementById('get-version');
getSources.addEventListener('click', function() {
ssf.getVersionInfo().then(function(verInfo) {
var verEl = document.getElementById('info');
verEl.innerText = '\napi ver=' + verInfo.apiVer +
'\ncontainer identifier=' + verInfo.containerIdentifier +
'\ncontainer ver=' + verInfo.containerVer
})
});
</script>
</html>

View File

@ -58,8 +58,19 @@ function createAPI() {
// API exposed to renderer process.
//
window.ssf = {
// api version
version: '1.0.0',
getVersionInfo: function() {
return new Promise(function(resolve) {
var appName = remote.app.getName();
var appVer = remote.app.getVersion();
const verInfo = {
containerIdentifier: appName,
containerVer: appVer,
apiVer: '1.0.0'
}
resolve(verInfo);
});
},
/**
* sets the count on the tray icon to the given number.