The worker's base URL is it's path:
- Code: Select all
index.html
scripts
\-- worker.js
modules
\-- myModule.js
If my module can work with or without worker, I must use
- Code: Select all
<script src="modules/myModule.js" />
- Code: Select all
importScripts('../modules/myModule.js')
It will be good to import scripts relative to the main document, not the worker. Like in PHP's require() or import().
* What is the feature you are suggesting to help solve it?
- Code: Select all
var worker = new Worker('scriptFile.js', 'baseURL');
or
- Code: Select all
var worker = new Worker('scriptFile.js',{baseUrl:'baseUrl'});
* What is the processing model for that feature, including error handling?
It doesn't change.
* Why do you think browsers would implement this feature?
It is easy to implement.
* Why do you think authors would use this feature?
It is more intuitive, than the current solution.
* What evidence is there that this feature is desparately needed?
There is no evidence. I am not sure, that this is a good idea. What do you think?
I have created a framework, which must load itself first. But if it is no beside the html nor the other scripts, the developer don't know, how can he import scripts with relative url, so I must convert every url to absolute url.
Sorry my english.