@kokimoki/app 1.0.8 → 1.0.10
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/kokimoki-store.d.ts +1 -0
- package/dist/kokimoki-store.js +5 -0
- package/dist/kokimoki.min.d.ts +1 -0
- package/dist/kokimoki.min.js +12408 -1
- package/dist/kokimoki.min.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/kokimoki-store.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export declare class KokimokiStore<T extends S.Generic<unknown>> {
|
|
|
10
10
|
readonly defaultValue: T["defaultValue"];
|
|
11
11
|
readonly docRoot: Y.Map<unknown>;
|
|
12
12
|
constructor(roomName: string, schema: T, mode?: RoomSubscriptionMode);
|
|
13
|
+
subscribe(callback: (value: T["defaultValue"]) => void): () => void;
|
|
13
14
|
}
|
package/dist/kokimoki-store.js
CHANGED
|
@@ -45,4 +45,9 @@ export class KokimokiStore {
|
|
|
45
45
|
// Set default value
|
|
46
46
|
this.defaultValue = schema.defaultValue;
|
|
47
47
|
}
|
|
48
|
+
subscribe(callback) {
|
|
49
|
+
const handler = () => callback(this.proxy);
|
|
50
|
+
this.doc.on("update", handler);
|
|
51
|
+
return () => this.doc.off("update", handler);
|
|
52
|
+
}
|
|
48
53
|
}
|
package/dist/kokimoki.min.d.ts
CHANGED
|
@@ -214,6 +214,7 @@ declare class KokimokiStore<T extends KokimokiSchema.Generic<unknown>> {
|
|
|
214
214
|
readonly defaultValue: T["defaultValue"];
|
|
215
215
|
readonly docRoot: Y.Map<unknown>;
|
|
216
216
|
constructor(roomName: string, schema: T, mode?: RoomSubscriptionMode);
|
|
217
|
+
subscribe(callback: (value: T["defaultValue"]) => void): () => void;
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
declare class KokimokiQueue<Req extends KokimokiSchema.Generic<unknown>> extends KokimokiStore<KokimokiSchema.Dict<KokimokiSchema.Struct<{
|