sliftutils 1.1.45 → 1.1.47
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/index.d.ts
CHANGED
|
@@ -769,7 +769,11 @@ declare module "sliftutils/storage/BulkDatabase2/BulkDatabase2" {
|
|
|
769
769
|
readonly name: string;
|
|
770
770
|
constructor(name: string);
|
|
771
771
|
static clearCache(): void;
|
|
772
|
-
|
|
772
|
+
storage: {
|
|
773
|
+
(): Promise<import("../FileFolderAPI").FileStorage>;
|
|
774
|
+
reset(): void;
|
|
775
|
+
set(newValue: Promise<import("../FileFolderAPI").FileStorage>): void;
|
|
776
|
+
};
|
|
773
777
|
private overlay;
|
|
774
778
|
private streamTimes;
|
|
775
779
|
private loadVersion;
|
package/package.json
CHANGED
|
@@ -4,7 +4,11 @@ export declare class BulkDatabase2<T extends {
|
|
|
4
4
|
readonly name: string;
|
|
5
5
|
constructor(name: string);
|
|
6
6
|
static clearCache(): void;
|
|
7
|
-
|
|
7
|
+
storage: {
|
|
8
|
+
(): Promise<import("../FileFolderAPI").FileStorage>;
|
|
9
|
+
reset(): void;
|
|
10
|
+
set(newValue: Promise<import("../FileFolderAPI").FileStorage>): void;
|
|
11
|
+
};
|
|
8
12
|
private overlay;
|
|
9
13
|
private streamTimes;
|
|
10
14
|
private loadVersion;
|
|
@@ -96,7 +96,7 @@ export class BulkDatabase2<T extends { key: string }> {
|
|
|
96
96
|
blockCache.clear();
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
public storage = lazy(async () => getFileStorageNested2(`${BULK_ROOT_FOLDER}/${this.name}`));
|
|
100
100
|
|
|
101
101
|
// In-memory overlay of pending writes/deletes, observable so reads re-render when it changes. It
|
|
102
102
|
// takes priority over the loaded readers, so writes are reflected in reads without reloading.
|
|
@@ -13,7 +13,11 @@ const subscribers = new Map<string, ((write: RemoteWrite) => void)[]>();
|
|
|
13
13
|
const recentResolvers = new Map<string, ((writes: RemoteWrite[]) => void)[]>();
|
|
14
14
|
|
|
15
15
|
export function isSyncSupported(): boolean {
|
|
16
|
-
|
|
16
|
+
if (typeof SharedWorker === "undefined") return false;
|
|
17
|
+
// Under file:// the SharedWorker constructor throws a SecurityError (cross-origin / opaque
|
|
18
|
+
// origin), so skip it rather than logging that error on every load.
|
|
19
|
+
if (typeof location !== "undefined" && location.protocol === "file:") return false;
|
|
20
|
+
return true;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
function ensure() {
|