mol_dump_lib 0.0.166 → 0.0.168

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/node.mjs CHANGED
@@ -84,7 +84,7 @@ var $;
84
84
  try {
85
85
  if (!having)
86
86
  return false;
87
- if (typeof having !== 'object')
87
+ if (typeof having !== 'object' && typeof having !== 'function')
88
88
  return false;
89
89
  if (having instanceof $mol_delegate)
90
90
  return false;
@@ -220,11 +220,12 @@ var $;
220
220
  return this.name;
221
221
  }
222
222
  destructor() { }
223
+ static destructor() { }
223
224
  toString() {
224
225
  return this[Symbol.toStringTag] || this.constructor.name + '()';
225
226
  }
226
227
  static toJSON() {
227
- return this.$.$mol_func_name(this);
228
+ return this[Symbol.toStringTag] || this.$.$mol_func_name(this);
228
229
  }
229
230
  toJSON() {
230
231
  return this.toString();
@@ -5131,19 +5132,44 @@ var $;
5131
5132
  ;
5132
5133
  "use strict";
5133
5134
  var $;
5135
+ (function ($) {
5136
+ $.$mol_mem_persist = $mol_wire_solid;
5137
+ })($ || ($ = {}));
5138
+ //mol/mem/persist/persist.ts
5139
+ ;
5140
+ "use strict";
5141
+ var $;
5134
5142
  (function ($) {
5135
5143
  class $mol_storage extends $mol_object2 {
5136
5144
  static native() {
5137
- return null;
5145
+ return this.$.$mol_dom_context.navigator.storage ?? {
5146
+ persisted: async () => false,
5147
+ persist: async () => false,
5148
+ estimate: async () => ({}),
5149
+ getDirectory: async () => null,
5150
+ };
5138
5151
  }
5139
- static persisted(next) {
5140
- return false;
5152
+ static persisted(next, cache) {
5153
+ $mol_mem_persist();
5154
+ if (cache)
5155
+ return Boolean(next);
5156
+ const native = this.native();
5157
+ if (next && !$mol_mem_cached(() => this.persisted())) {
5158
+ native.persist().then(actual => {
5159
+ setTimeout(() => this.persisted(actual, 'cache'), 5000);
5160
+ if (actual)
5161
+ this.$.$mol_log3_rise({ place: `$mol_storage`, message: `Persist: Yes` });
5162
+ else
5163
+ this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
5164
+ });
5165
+ }
5166
+ return next ?? $mol_wire_sync(native).persisted();
5141
5167
  }
5142
5168
  static estimate() {
5143
- return 0;
5169
+ return $mol_wire_sync(this.native() ?? {}).estimate();
5144
5170
  }
5145
5171
  static dir() {
5146
- return null;
5172
+ return $mol_wire_sync(this.native()).getDirectory();
5147
5173
  }
5148
5174
  }
5149
5175
  __decorate([
@@ -5154,7 +5180,7 @@ var $;
5154
5180
  ], $mol_storage, "persisted", null);
5155
5181
  $.$mol_storage = $mol_storage;
5156
5182
  })($ || ($ = {}));
5157
- //mol/storage/storage.node.ts
5183
+ //mol/storage/storage.ts
5158
5184
  ;
5159
5185
  "use strict";
5160
5186
  var $;
package/node.test.js CHANGED
@@ -76,7 +76,7 @@ var $;
76
76
  try {
77
77
  if (!having)
78
78
  return false;
79
- if (typeof having !== 'object')
79
+ if (typeof having !== 'object' && typeof having !== 'function')
80
80
  return false;
81
81
  if (having instanceof $mol_delegate)
82
82
  return false;
@@ -212,11 +212,12 @@ var $;
212
212
  return this.name;
213
213
  }
214
214
  destructor() { }
215
+ static destructor() { }
215
216
  toString() {
216
217
  return this[Symbol.toStringTag] || this.constructor.name + '()';
217
218
  }
218
219
  static toJSON() {
219
- return this.$.$mol_func_name(this);
220
+ return this[Symbol.toStringTag] || this.$.$mol_func_name(this);
220
221
  }
221
222
  toJSON() {
222
223
  return this.toString();
@@ -5123,19 +5124,44 @@ var $;
5123
5124
  ;
5124
5125
  "use strict";
5125
5126
  var $;
5127
+ (function ($) {
5128
+ $.$mol_mem_persist = $mol_wire_solid;
5129
+ })($ || ($ = {}));
5130
+ //mol/mem/persist/persist.ts
5131
+ ;
5132
+ "use strict";
5133
+ var $;
5126
5134
  (function ($) {
5127
5135
  class $mol_storage extends $mol_object2 {
5128
5136
  static native() {
5129
- return null;
5137
+ return this.$.$mol_dom_context.navigator.storage ?? {
5138
+ persisted: async () => false,
5139
+ persist: async () => false,
5140
+ estimate: async () => ({}),
5141
+ getDirectory: async () => null,
5142
+ };
5130
5143
  }
5131
- static persisted(next) {
5132
- return false;
5144
+ static persisted(next, cache) {
5145
+ $mol_mem_persist();
5146
+ if (cache)
5147
+ return Boolean(next);
5148
+ const native = this.native();
5149
+ if (next && !$mol_mem_cached(() => this.persisted())) {
5150
+ native.persist().then(actual => {
5151
+ setTimeout(() => this.persisted(actual, 'cache'), 5000);
5152
+ if (actual)
5153
+ this.$.$mol_log3_rise({ place: `$mol_storage`, message: `Persist: Yes` });
5154
+ else
5155
+ this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
5156
+ });
5157
+ }
5158
+ return next ?? $mol_wire_sync(native).persisted();
5133
5159
  }
5134
5160
  static estimate() {
5135
- return 0;
5161
+ return $mol_wire_sync(this.native() ?? {}).estimate();
5136
5162
  }
5137
5163
  static dir() {
5138
- return null;
5164
+ return $mol_wire_sync(this.native()).getDirectory();
5139
5165
  }
5140
5166
  }
5141
5167
  __decorate([
@@ -5146,7 +5172,7 @@ var $;
5146
5172
  ], $mol_storage, "persisted", null);
5147
5173
  $.$mol_storage = $mol_storage;
5148
5174
  })($ || ($ = {}));
5149
- //mol/storage/storage.node.ts
5175
+ //mol/storage/storage.ts
5150
5176
  ;
5151
5177
  "use strict";
5152
5178
  var $;