-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptProcess.js
More file actions
30 lines (29 loc) · 799 Bytes
/
ScriptProcess.js
File metadata and controls
30 lines (29 loc) · 799 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 scriptProcess (arrCsv) {
console.log("Starting up Script Process");
var textCommands = arrCsv.split(',');
var commands = [];
for (var i=0;i<textCommands.length;i++)
{
commands.push('run: ' + textCommands[i].replace(/\s*/,''));
}
console.log("Commands: " + commands);
return commands.join(', ');
}
//The function that signifies the message received from the OS.
onmessage = function (event){
var errorCon = 0;
var arrCsv = event.data.data;
var nResult;
try{
nResult = scriptProcess(arrCsv);
} catch(err){
nResult = "";
errorCon = -1;
}
var scriptResult = {
result : nResult,
processNumberI : event.data.nProcessID,
errorCon : errorCon
};
postMessage(scriptResult);
}