-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadFile.js
More file actions
30 lines (29 loc) · 800 Bytes
/
Copy pathReadFile.js
File metadata and controls
30 lines (29 loc) · 800 Bytes
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
function readFile(arrNum) {
console.log("Starting extra process");
console.log(arrNum);
if(typeof arrNum === 'undefined') {
return "undefined";
}
var arrNumSplit = arrNum.split(", ").map(Number);
arrNumSplit.sort(function(a, b){return a-b});
return arrNumSplit.join(", ");
console.log("Ending extra process");
}
//The function that signifies the message received from the OS.
onmessage = function (event) {
var errorCon = 0;
var arrCsv = event.data.data;
var szResult;
try{
szResult = readFile(arrCsv);
}catch(err){
szResult = "";
errorCon = -1;
}
var readResult = {
result : szResult,
processNumberI : event.data.nProcessID,
errorCon : errorCon
}
postMessage(readResult);
};