sliftutils 1.2.7 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builders/hotReload.ts +1 -1
- package/package.json +1 -1
- package/storage/FileFolderAPI.tsx +34 -18
package/builders/hotReload.ts
CHANGED
|
@@ -89,7 +89,7 @@ function chromeExtensionContentScriptHotReload() {
|
|
|
89
89
|
|
|
90
90
|
port.onDisconnect.addListener(() => {
|
|
91
91
|
let timeToFail = Date.now() - startTime;
|
|
92
|
-
if (timeToFail
|
|
92
|
+
if (timeToFail < 10000) {
|
|
93
93
|
console.warn("[Hot Reload] Could not connect to background script. Make sure the background script calls enableHotReloading().");
|
|
94
94
|
return;
|
|
95
95
|
}
|
package/package.json
CHANGED
|
@@ -255,26 +255,42 @@ export const getDirectoryHandle = lazy(async function getDirectoryHandle(): Prom
|
|
|
255
255
|
retryCallback = resolve;
|
|
256
256
|
});
|
|
257
257
|
displayData.ui = (
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
258
|
+
<div className={css.vbox(20).center}>
|
|
259
|
+
<button
|
|
260
|
+
className={css.fontSize(40).pad2(80, 40)}
|
|
261
|
+
onClick={async () => {
|
|
262
|
+
displayData.ui = "Loading...";
|
|
263
|
+
try {
|
|
264
|
+
const retryHandle = await tryToLoadPointer(storedId);
|
|
265
|
+
if (retryHandle) {
|
|
266
|
+
handle = retryHandle;
|
|
267
|
+
retryCallback(true);
|
|
268
|
+
} else {
|
|
269
|
+
retryCallback(false);
|
|
270
|
+
}
|
|
271
|
+
} catch (retryError) {
|
|
272
|
+
console.error("Retry failed:", retryError);
|
|
268
273
|
retryCallback(false);
|
|
269
274
|
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
277
|
+
Click to restore file system access
|
|
278
|
+
</button>
|
|
279
|
+
<button
|
|
280
|
+
className={css.fontSize(40).pad2(80, 40)}
|
|
281
|
+
onClick={async () => {
|
|
282
|
+
console.log("Waiting for user to give permission");
|
|
283
|
+
const pickedHandle = await window.showDirectoryPicker();
|
|
284
|
+
await pickedHandle.requestPermission({ mode: "readwrite" });
|
|
285
|
+
let newStoredId = await storeFileSystemPointer({ mode: "readwrite", handle: pickedHandle });
|
|
286
|
+
localStorage.setItem(getFileAPIKey(), newStoredId);
|
|
287
|
+
handle = pickedHandle as any;
|
|
288
|
+
retryCallback(true);
|
|
289
|
+
}}
|
|
290
|
+
>
|
|
291
|
+
Pick Data Directory
|
|
292
|
+
</button>
|
|
293
|
+
</div>
|
|
278
294
|
);
|
|
279
295
|
const success = await retryPromise;
|
|
280
296
|
if (handle) {
|