hyoo_sync_client 0.0.232 → 0.0.234

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/web.mjs CHANGED
@@ -2149,6 +2149,88 @@ var $;
2149
2149
  ;
2150
2150
  "use strict";
2151
2151
  var $;
2152
+ (function ($) {
2153
+ function $mol_wire_solid() {
2154
+ const current = $mol_wire_auto();
2155
+ if (current.reap !== nothing) {
2156
+ current?.sub_on(sub, sub.data.length);
2157
+ }
2158
+ current.reap = nothing;
2159
+ }
2160
+ $.$mol_wire_solid = $mol_wire_solid;
2161
+ const nothing = () => { };
2162
+ const sub = new $mol_wire_pub_sub;
2163
+ })($ || ($ = {}));
2164
+ //mol/wire/solid/solid.ts
2165
+ ;
2166
+ "use strict";
2167
+ var $;
2168
+ (function ($) {
2169
+ $.$mol_mem_persist = $mol_wire_solid;
2170
+ })($ || ($ = {}));
2171
+ //mol/mem/persist/persist.ts
2172
+ ;
2173
+ "use strict";
2174
+ var $;
2175
+ (function ($) {
2176
+ function $mol_wire_probe(task, def) {
2177
+ const warm = $mol_wire_fiber.warm;
2178
+ try {
2179
+ $mol_wire_fiber.warm = false;
2180
+ const res = task();
2181
+ if (res === undefined)
2182
+ return def;
2183
+ return res;
2184
+ }
2185
+ finally {
2186
+ $mol_wire_fiber.warm = warm;
2187
+ }
2188
+ }
2189
+ $.$mol_wire_probe = $mol_wire_probe;
2190
+ })($ || ($ = {}));
2191
+ //mol/wire/probe/probe.ts
2192
+ ;
2193
+ "use strict";
2194
+ var $;
2195
+ (function ($) {
2196
+ $.$mol_mem_cached = $mol_wire_probe;
2197
+ })($ || ($ = {}));
2198
+ //mol/mem/cached/cached.ts
2199
+ ;
2200
+ "use strict";
2201
+ var $;
2202
+ (function ($) {
2203
+ class $mol_storage extends $mol_object2 {
2204
+ static native() {
2205
+ return $mol_wire_sync(this.$.$mol_dom_context.navigator.storage);
2206
+ }
2207
+ static persisted(next) {
2208
+ $mol_mem_persist();
2209
+ const native = this.native();
2210
+ const prev = $mol_mem_cached(() => this.persisted()) ?? native.persisted();
2211
+ if (next && !prev)
2212
+ native.persist();
2213
+ return next ?? prev;
2214
+ }
2215
+ static estimate() {
2216
+ return this.native().estimate();
2217
+ }
2218
+ static dir() {
2219
+ return this.native().getDirectory();
2220
+ }
2221
+ }
2222
+ __decorate([
2223
+ $mol_mem
2224
+ ], $mol_storage, "native", null);
2225
+ __decorate([
2226
+ $mol_mem
2227
+ ], $mol_storage, "persisted", null);
2228
+ $.$mol_storage = $mol_storage;
2229
+ })($ || ($ = {}));
2230
+ //mol/storage/storage.web.ts
2231
+ ;
2232
+ "use strict";
2233
+ var $;
2152
2234
  (function ($) {
2153
2235
  class $mol_state_local extends $mol_object {
2154
2236
  static 'native()';
@@ -2183,10 +2265,18 @@ var $;
2183
2265
  this.changes();
2184
2266
  if (next === void 0)
2185
2267
  return JSON.parse(this.native().getItem(key) || 'null');
2186
- if (next === null)
2268
+ if (next === null) {
2187
2269
  this.native().removeItem(key);
2188
- else
2270
+ }
2271
+ else {
2189
2272
  this.native().setItem(key, JSON.stringify(next));
2273
+ try {
2274
+ this.$.$mol_storage.persisted(true);
2275
+ }
2276
+ catch (error) {
2277
+ $mol_fail_log(error);
2278
+ }
2279
+ }
2190
2280
  return next;
2191
2281
  }
2192
2282
  prefix() { return ''; }
@@ -2261,22 +2351,6 @@ var $;
2261
2351
  ;
2262
2352
  "use strict";
2263
2353
  var $;
2264
- (function ($) {
2265
- function $mol_wire_solid() {
2266
- const current = $mol_wire_auto();
2267
- if (current.reap !== nothing) {
2268
- current?.sub_on(sub, sub.data.length);
2269
- }
2270
- current.reap = nothing;
2271
- }
2272
- $.$mol_wire_solid = $mol_wire_solid;
2273
- const nothing = () => { };
2274
- const sub = new $mol_wire_pub_sub;
2275
- })($ || ($ = {}));
2276
- //mol/wire/solid/solid.ts
2277
- ;
2278
- "use strict";
2279
- var $;
2280
2354
  (function ($) {
2281
2355
  class $mol_wrapper extends $mol_object2 {
2282
2356
  static wrap;
@@ -3911,26 +3985,6 @@ var $;
3911
3985
  ;
3912
3986
  "use strict";
3913
3987
  var $;
3914
- (function ($) {
3915
- function $mol_wire_probe(task, def) {
3916
- const warm = $mol_wire_fiber.warm;
3917
- try {
3918
- $mol_wire_fiber.warm = false;
3919
- const res = task();
3920
- if (res === undefined)
3921
- return def;
3922
- return res;
3923
- }
3924
- finally {
3925
- $mol_wire_fiber.warm = warm;
3926
- }
3927
- }
3928
- $.$mol_wire_probe = $mol_wire_probe;
3929
- })($ || ($ = {}));
3930
- //mol/wire/probe/probe.ts
3931
- ;
3932
- "use strict";
3933
- var $;
3934
3988
  (function ($) {
3935
3989
  class $mol_db_database {
3936
3990
  native;
@@ -4059,6 +4113,7 @@ var $;
4059
4113
  Unit.put(unit, [unit.land, unit.head, unit.self]);
4060
4114
  }
4061
4115
  await trans.commit();
4116
+ this.$.$mol_storage.native().persist();
4062
4117
  }
4063
4118
  reconnects(reset) {
4064
4119
  return ($mol_wire_probe(() => this.reconnects()) ?? 0) + 1;