I'm creating application in qml where I want to download data from internet. To avoid blocking of main thread I created WorkerScript file. This works fine, but I need to abstract certain parts (like authorization, proper header, etc) to general-purpose functions.
Unfortunatelly I haven't found a way to import js file to js file that serves as worker thread. ".import" causes syntax error.
How can I achieve this?
Thank you.
Edit:
This is the relevant part from qml file:
Page {
WorkerScript {
id: myWorker
source: Qt.resolvedUrl("loadDetails.js")
onMessage: {}
}
}
And this is loadDetails.js:
.import "jsonrpc.js" as Jrpc
WorkerScript.onMessage = function(message) {
// This is where I want to call functions from included file
}
See documentation provided by Oleg:
Worker script can not use .import syntax.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments