1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-27 16:10:57 -05:00
denoland-deno/cli/tests/import_blob_url_jsx.ts
Luca Casonato 966ce7de8a
feat: blob URL support (#10045)
This commit adds blob URL support. Blob URLs are stored in a process
global storage, that can be accessed from all workers, and the module
loader. Blob URLs can be created using `URL.createObjectURL` and revoked
using `URL.revokeObjectURL`.

This commit does not add support for `fetch`ing blob URLs. This will be
added in a follow up commit.
2021-04-07 15:22:14 +02:00

16 lines
360 B
TypeScript

const blob = new Blob(
["export default function() {\n return <div>Hello Deno!</div>\n}\n"],
{ type: "text/jsx" },
);
const url = URL.createObjectURL(blob);
const { default: render } = await import(url);
// deno-lint-ignore no-explicit-any
(globalThis as any).React = {
createElement(...args: unknown[]) {
console.log(...args);
},
};
render();