-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URL.createObjectURL #479
Comments
I suspect the problem is that the URL represents a FIle or Blob, and it tries to read the file, which fails with a nu such file error. Do you know where in mqtt.js the failure occurs? |
Correct, this is a Blob |
After further analysis, the generated blob object url is passed as argument to a |
Got it. Looks like txiki.js would need to implement a Blob store so those URLs are mapped to something that other APIs can read. I see Deno has it, we could borrow some inspiration from there... |
For reference: #545 (comment) |
I'm working on a simple solution. I should PR in the coming days. But I would need review/help for sure to improve the quality of the solution. |
Sure thing! |
Hey, I would like to ask your help concerning the missing
URL.createObjectURL
browser feature.Here's some background, I would like to use the MQTT.js library (https://github.com/mqttjs/MQTT.js), which is compatible with browsers. However, I encountered two problems:
document
variable is defined in the global scope (because it is also compatible with Node.js by using the ws lib instead of "native" WebSocket). Thus I just added:src/js/polyfills/global.js
fileURL.createObjectURL
https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static andURL.revokeObjectURL
https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL_static functionsThis is where I ask for your help, do you think there is a way to make this feature work in
txiki.js
?Here is what I've tried (this is really naïve); I've added:
to
src/js/polyfills/url.js
After that, the lib does not require additional feature, and even work in some way, but it logs the following error:
ReferenceError: could not load '<the random string generated>' - ENOENT: no such file or directory
The text was updated successfully, but these errors were encountered: