1
I have serious problems, I have a Webworker that imports a file, but when calling the function with the variable does not work. See:
importScripts(
'./libs/RSA.js'
);
self.onmessage = function (e) {
JSEncrypt.getKey(function () {
privateKey = RSA.getPrivateKey();
publicKey = RSA.getPublicKey();
});
}
The RSA file is nothing more than: http://travistidwell.com/jsencrypt/bin/jsencrypt.js
The error returned is: Uncaught Typeerror: RSA.getKey is not a Function
Where did you define
RSA
, and what is your type? I couldn’t find any variables calledRSA
in the linked file...– mgibsonbr
Lost linked file has variable
JSEncrypt
and mine was changed toRSA
, but I got it right. @mgibsonbr– Elaine
You used this
jsencrypt.js
as it is, or adapted it in some way? I tested here, and gotUncaught ReferenceError: window is not defined
- which is natural, since within the web worker no access towindow
. That is, he did not even run the line where defines theonmessage
, not responding to events sent from the main page.– mgibsonbr
i defined
var window = self;
@mgibsonbr according to a question on Soen– Elaine
Okay, I’ll repeat the test. Please mention this kind of thing in the question, otherwise it’s hard to know what’s going on. I suggest you also read this: http://answall.com/help/mcve. (P.S. Now yes I got the same error; it is already a progress... : P)
– mgibsonbr