monoidentity 0.31.5 → 0.31.6
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/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const STORAGE_EVENT = "monoidentity-storage";
|
|
4
|
-
type StorageEventDetail = {
|
|
5
|
-
key: string;
|
|
6
|
-
value: string | undefined;
|
|
7
|
-
isSync: boolean;
|
|
8
|
-
};
|
|
9
|
-
declare global {
|
|
10
|
-
interface WindowEventMap {
|
|
11
|
-
'monoidentity-storage': CustomEvent<StorageEventDetail>;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
declare const storageClient: (prefix?: (key: string) => string, unprefix?: (key: string) => string | undefined, serialize?: (data: any) => string, deserialize?: (data: string) => any, isSyncContext?: boolean) => Record<string, any>;
|
|
15
|
-
//#endregion
|
|
1
|
+
import { STORAGE_EVENT, SYNC_REQUEST_EVENT, storageClient } from "./storageclient.svelte.mjs";
|
|
2
|
+
|
|
16
3
|
//#region src/index.d.ts
|
|
17
4
|
declare const getLoginRecognized: () => {
|
|
18
5
|
email: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { STORAGE_EVENT, SYNC_REQUEST_EVENT, storageClient } from "./storageclient.svelte.mjs";
|
|
2
2
|
import { parse, stringify } from "devalue";
|
|
3
3
|
import { email, object, parse as parse$1, pipe, string } from "valibot";
|
|
4
4
|
import { decode } from "base36-esm";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/storageclient.svelte.d.ts
|
|
2
|
+
declare const SYNC_REQUEST_EVENT = "monoidentity-sync-request";
|
|
3
|
+
declare const STORAGE_EVENT = "monoidentity-storage";
|
|
4
|
+
type StorageEventDetail = {
|
|
5
|
+
key: string;
|
|
6
|
+
value: string | undefined;
|
|
7
|
+
isSync: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare global {
|
|
10
|
+
interface WindowEventMap {
|
|
11
|
+
'monoidentity-storage': CustomEvent<StorageEventDetail>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const storageClient: (prefix?: (key: string) => string, unprefix?: (key: string) => string | undefined, serialize?: (data: any) => string, deserialize?: (data: string) => any, isSyncContext?: boolean) => Record<string, any>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { STORAGE_EVENT, SYNC_REQUEST_EVENT, storageClient };
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
const SYNC_REQUEST_EVENT = "monoidentity-sync-request";
|
|
3
3
|
const STORAGE_EVENT = "monoidentity-storage";
|
|
4
4
|
const waitForSync = async (key) => {
|
|
5
|
-
await new Promise((resolve, reject) =>
|
|
5
|
+
await new Promise((resolve, reject) => dispatchEvent(new CustomEvent(SYNC_REQUEST_EVENT, { detail: {
|
|
6
6
|
key,
|
|
7
7
|
resolve,
|
|
8
8
|
reject
|
|
9
9
|
} })));
|
|
10
10
|
};
|
|
11
11
|
const announce = (key, value, isSync = false) => {
|
|
12
|
-
|
|
12
|
+
dispatchEvent(new CustomEvent(STORAGE_EVENT, { detail: {
|
|
13
13
|
key,
|
|
14
14
|
value,
|
|
15
15
|
isSync
|
|
@@ -83,4 +83,4 @@ const storageClient = (prefix, unprefix, serialize, deserialize, isSyncContext =
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
//#endregion
|
|
86
|
-
export { SYNC_REQUEST_EVENT
|
|
86
|
+
export { STORAGE_EVENT, SYNC_REQUEST_EVENT, storageClient };
|