Workers - URLSearchParams

New to workers. here is what I would like to do;

run my worker url, i.e.

in this worker process, I would like to take this “ID” and use it further in the worker process to do other actions. If I don’t pass the ID value and instead hardcode it into the worker, the remainder of the process functions as it should, but when I try to pass the variable ID to the worker, then the result data is incorrect. following I will add copies of each code. can somebody please point out where my ‘variable code’ fails. thanks. I am just going to show the first lines of the worker process because that is where the process is failing. Neither is throwing an error, but in case 2, it is the ID and thus the videoID that are not passing the correct value to the rest of the script.

Case 1. all values hardcoded, works fine.

// Global variables
const videoID = ‘myvideoid value’
const jwkKey = ‘mykey value’
const keyID = ‘mykeyid value’

Case 2. variable values in worker

// Global variables
const queryString = URL;
const urlParams = new URLSearchParams(queryString);
const videoID = urlParams.values(‘idnum’)
const jwkKey = ‘mykey value’
const keyID = ‘mykeyid value’

thanks, Robert

I am afraid that’s rather a question for StackOverflow than here. I would suggest you look at the documentation of values() and compare that to the other functions offered by that class

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.