Skip to content Skip to sidebar Skip to footer

Html 5 Webworkers With Multiple Arguments

I just got into HTML5 webworkers and now I want to pass multiple arguments to my worker. I have this in my page: var username = document.getElementById('username').value; var se

Solution 1:

Post like this:

w.postMessage({user:username,url:server_url})

on message event do:

onmessage = function (e) {
    username = e.data.user;
    server_url = e.data.url;
}

Post a Comment for "Html 5 Webworkers With Multiple Arguments"