Spaces:
Running
Running
Route Lite bootstrap to compatibility worker
Browse files- index.html +18 -0
index.html
CHANGED
|
@@ -10,6 +10,24 @@
|
|
| 10 |
href="https://cdn.jsdelivr.net/npm/@gradio/lite@4.43.2/dist/lite.css"
|
| 11 |
>
|
| 12 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
const replaceLiteWorker = (WorkerClass) => class extends WorkerClass {
|
| 14 |
constructor(url, options) {
|
| 15 |
const source = String(url);
|
|
|
|
| 10 |
href="https://cdn.jsdelivr.net/npm/@gradio/lite@4.43.2/dist/lite.css"
|
| 11 |
>
|
| 12 |
<script>
|
| 13 |
+
const nativeBlob = window.Blob;
|
| 14 |
+
const localLiteWorker = new URL(
|
| 15 |
+
"./gradio-lite-worker.js?v=3",
|
| 16 |
+
window.location.href,
|
| 17 |
+
).href;
|
| 18 |
+
|
| 19 |
+
window.Blob = class extends nativeBlob {
|
| 20 |
+
constructor(parts = [], options) {
|
| 21 |
+
const patchedParts = parts.map((part) => {
|
| 22 |
+
if (typeof part !== "string" || !part.includes("webworker-Er6yXxw8.js")) {
|
| 23 |
+
return part;
|
| 24 |
+
}
|
| 25 |
+
return `importScripts("${localLiteWorker}");`;
|
| 26 |
+
});
|
| 27 |
+
super(patchedParts, options);
|
| 28 |
+
}
|
| 29 |
+
};
|
| 30 |
+
|
| 31 |
const replaceLiteWorker = (WorkerClass) => class extends WorkerClass {
|
| 32 |
constructor(url, options) {
|
| 33 |
const source = String(url);
|