-
Notifications
You must be signed in to change notification settings - Fork 0
/
inputPoints.js
31 lines (27 loc) · 1.02 KB
/
inputPoints.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
const electron = require('electron');
const {ipcRenderer, remote} = electron;
let lines;
const addPoint = document.getElementById("addPoint");
ipcRenderer.send('sendLines');
ipcRenderer.on('data', (event, data) => {
lines = data.msg;
for(let i = 0; i < lines; i++){
//Dodanie inputów do dodania punktu na wykresie
let text = document.createElement("input");
text.type = "number";
text.placeholder = "kolumna nr " + (i+1).toString();
text.name = i.toString();
text.id = i.toString();
text.className = "pointInputs"
addPoint.insertBefore(text, addPoint.childNodes[i]);
}
const addPointButton = document.getElementById("addPointButton");
let dataToSend = [];
addPointButton.addEventListener('click', ()=>{
for(let i = 0; i < lines; i++){
dataToSend.push(Number.parseFloat(document.getElementById(i.toString()).value));
}
ipcRenderer.send('point', dataToSend);
remote.getCurrentWindow().close();
});
});