mirror of
https://github.com/moparisthebest/mail
synced 2025-01-30 22:50:17 -05:00
cleaned up web worker code
This commit is contained in:
parent
edf78bc1af
commit
3f82fdf960
@ -16,7 +16,7 @@
|
||||
* In the web worker thread context, 'this' and 'self' can be used as a global
|
||||
* variable namespace similar to the 'window' object in the main thread
|
||||
*/
|
||||
self.addEventListener('message', function(e) {
|
||||
self.onmessage = function(e) {
|
||||
|
||||
var args = e.data,
|
||||
output = null,
|
||||
@ -37,6 +37,6 @@
|
||||
|
||||
// pass output back to main thread
|
||||
self.postMessage(output);
|
||||
}, false);
|
||||
};
|
||||
|
||||
}());
|
@ -15,7 +15,7 @@
|
||||
* In the web worker thread context, 'this' and 'self' can be used as a global
|
||||
* variable namespace similar to the 'window' object in the main thread
|
||||
*/
|
||||
self.addEventListener('message', function(e) {
|
||||
self.onmessage = function(e) {
|
||||
|
||||
var args = e.data,
|
||||
output = null,
|
||||
@ -35,6 +35,6 @@
|
||||
|
||||
// pass output back to main thread
|
||||
self.postMessage(output);
|
||||
}, false);
|
||||
};
|
||||
|
||||
}());
|
@ -54,10 +54,10 @@ app.crypto.Crypto = function(window, util) {
|
||||
// init webworker thread
|
||||
var worker = new Worker(app.config.workerPath + '/crypto/pbkdf2-worker.js');
|
||||
|
||||
worker.addEventListener('message', function(e) {
|
||||
worker.onmessage = function(e) {
|
||||
// return derived key from the worker
|
||||
callback(e.data);
|
||||
}, false);
|
||||
};
|
||||
|
||||
// send plaintext data to the worker
|
||||
worker.postMessage({
|
||||
@ -81,9 +81,9 @@ app.crypto.Crypto = function(window, util) {
|
||||
if (window.Worker) {
|
||||
|
||||
var worker = new Worker(app.config.workerPath + '/crypto/aes-worker.js');
|
||||
worker.addEventListener('message', function(e) {
|
||||
worker.onmessage = function(e) {
|
||||
callback(e.data);
|
||||
}, false);
|
||||
};
|
||||
worker.postMessage({
|
||||
type: 'encrypt',
|
||||
plaintext: plaintext,
|
||||
@ -101,9 +101,9 @@ app.crypto.Crypto = function(window, util) {
|
||||
if (window.Worker) {
|
||||
|
||||
var worker = new Worker(app.config.workerPath + '/crypto/aes-worker.js');
|
||||
worker.addEventListener('message', function(e) {
|
||||
worker.onmessage = function(e) {
|
||||
callback(e.data);
|
||||
}, false);
|
||||
};
|
||||
worker.postMessage({
|
||||
type: 'decrypt',
|
||||
ciphertext: ciphertext,
|
||||
@ -133,9 +133,9 @@ app.crypto.Crypto = function(window, util) {
|
||||
if (window.Worker) {
|
||||
|
||||
var worker = new Worker(app.config.workerPath + '/crypto/aes-batch-worker.js');
|
||||
worker.addEventListener('message', function(e) {
|
||||
worker.onmessage = function(e) {
|
||||
callback(e.data);
|
||||
}, false);
|
||||
};
|
||||
worker.postMessage({
|
||||
type: 'encrypt',
|
||||
list: list
|
||||
@ -151,9 +151,9 @@ app.crypto.Crypto = function(window, util) {
|
||||
if (window.Worker) {
|
||||
|
||||
var worker = new Worker(app.config.workerPath + '/crypto/aes-batch-worker.js');
|
||||
worker.addEventListener('message', function(e) {
|
||||
worker.onmessage = function(e) {
|
||||
callback(e.data);
|
||||
}, false);
|
||||
};
|
||||
worker.postMessage({
|
||||
type: 'decrypt',
|
||||
list: list
|
||||
|
@ -14,7 +14,7 @@
|
||||
* In the web worker thread context, 'this' and 'self' can be used as a global
|
||||
* variable namespace similar to the 'window' object in the main thread
|
||||
*/
|
||||
self.addEventListener('message', function(e) {
|
||||
self.onmessage = function(e) {
|
||||
|
||||
var args = e.data,
|
||||
key = null;
|
||||
@ -30,6 +30,6 @@
|
||||
|
||||
// pass output back to main thread
|
||||
self.postMessage(key);
|
||||
}, false);
|
||||
};
|
||||
|
||||
}());
|
Loading…
Reference in New Issue
Block a user