Click here to Skip to main content
15,881,381 members

Comments by Jonathan Cardy (Top 10 by date)

Jonathan Cardy 26-May-11 6:03am View    
What is the string value of Session['priceday1']? Is it convertable to an int?
Jonathan Cardy 1-May-11 7:27am View    
Yes, you're right: unless you are doing a lot of intensive computation in the Worker, it's pointless.
Jonathan Cardy 1-May-11 4:17am View    
Your code is fine, I just made some small changes to get it to work:

- Wrapped your code in the window load event
- Uppercase 'W' in Worker

Also, does your browser definitely support Web Workers?

worker.js:
function applyValues(radius, size) {
return radius + "," + size;
}

/*
Add a event listener to the worker, this will
be called when the worker receives a message
from the main page.
*/
self.onmessage = function(event) {
var data = event.data;
postMessage(applyValues(data.radius, data.size));
};


page:
window.addEventListener("load", function(){
if (typeof (Worker) !== "undefined") {
var radius, size, message,
worker = new Worker("worker.js");

/*
Add a event listener to the worker, this will
be called when the worker posts a message.
*/
worker.onmessage = function(event) {
alert(event.data);
};

// Register event for button
document.getElementById("btn").onclick = function() {
message = {'radius': 2, 'size': 3 };
worker.postMessage(message);
}
}
}, false);
Jonathan Cardy 28-Apr-11 5:25am View    
You might want to try Chrome - it provides useful debugging features for Web Workers and will give you a pretty accurate picture of what the end result will be in Blackberry.
Jonathan Cardy 18-Apr-11 16:50pm View    
There are probably numerous problems, but to get you started, "<%=TextBox1.clientid%>" is not a CSS selector - try "$('#TextBox1')"