You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
551 B
JavaScript
29 lines
551 B
JavaScript
5 years ago
|
//This worker will be used for cryptographic, long running and API calls
|
||
|
//to keep the UI free
|
||
|
//
|
||
|
const name = 'main'
|
||
|
|
||
|
function getSHA256(file){
|
||
|
console.log('getting sha 256 for ');
|
||
|
console.log(file);
|
||
|
|
||
|
}
|
||
|
|
||
|
onmessage = function(e) {
|
||
|
|
||
|
switch (e.data.msg) {
|
||
|
case 'init':
|
||
|
console.log(`initialized ${name} worker`);
|
||
|
break;
|
||
|
|
||
|
case 'file-sha256':
|
||
|
getSHA256(e.data.payload)
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
console.log(`${name} worker: need {msg: "message type", ... }`)
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|