-
Notifications
You must be signed in to change notification settings - Fork 1
/
renderer1.js
60 lines (40 loc) · 1.27 KB
/
renderer1.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.
//hide
'use strict'
window.$ = window.jQuery = require('jquery')
window.Bootstrap = require('bootstrap')
var refreshValue;
function refresh(node)
{
var times = refreshValue; // gap in Milli Seconds;
(function startRefresh()
{
var address;
if(node.src.indexOf('&cb=')>-1)
address = node.src.split('&cb=')[0];
else
address = node.src;
node.src = address+"&cb="+new Date().getTime();
node.src.reload
setTimeout(startRefresh,times);
})();
}
window.onload = function()
{
// In renderer process (web page).
const {ipcRenderer} = require('electron')
var myCameraURLs = JSON.parse(ipcRenderer.sendSync('getConfigData', 'sendfromrender'));
if(typeof myCameraURLs.refreshRate[0] === undefined){
} else {
refreshValue = myCameraURLs.refreshRate[0];
}
if(typeof myCameraURLs.cameras[0] === undefined){
} else {
document.getElementById('paneOneImg').src = myCameraURLs.cameras[0];
}
var nodeOne = document.getElementById('paneOneImg')
refresh(nodeOne);
// you can refresh as many images you want just repeat above steps
}