dexie 3.2.2 → 3.2.4-beta.1

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.
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 3.2.2, Wed Apr 27 2022
7
+ * Version 3.2.4-beta.1, Tue May 30 2023
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -1242,7 +1242,7 @@ function tempTransaction(db, mode, storeNames, fn) {
1242
1242
  }
1243
1243
  }
1244
1244
 
1245
- const DEXIE_VERSION = '3.2.2';
1245
+ const DEXIE_VERSION = '3.2.4-beta.1';
1246
1246
  const maxString = String.fromCharCode(65535);
1247
1247
  const minKey = -Infinity;
1248
1248
  const INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -4811,7 +4811,9 @@ function extendObservabilitySet(target, newSet) {
4811
4811
  }
4812
4812
 
4813
4813
  function liveQuery(querier) {
4814
- return new Observable((observer) => {
4814
+ let hasValue = false;
4815
+ let currentValue = undefined;
4816
+ const observable = new Observable((observer) => {
4815
4817
  const scopeFuncIsAsync = isAsyncFunction(querier);
4816
4818
  function execute(subscr) {
4817
4819
  if (scopeFuncIsAsync) {
@@ -4862,6 +4864,8 @@ function liveQuery(querier) {
4862
4864
  }
4863
4865
  querying = true;
4864
4866
  Promise.resolve(ret).then((result) => {
4867
+ hasValue = true;
4868
+ currentValue = result;
4865
4869
  querying = false;
4866
4870
  if (closed)
4867
4871
  return;
@@ -4875,6 +4879,7 @@ function liveQuery(querier) {
4875
4879
  }
4876
4880
  }, (err) => {
4877
4881
  querying = false;
4882
+ hasValue = false;
4878
4883
  observer.error && observer.error(err);
4879
4884
  subscription.unsubscribe();
4880
4885
  });
@@ -4882,6 +4887,9 @@ function liveQuery(querier) {
4882
4887
  doQuery();
4883
4888
  return subscription;
4884
4889
  });
4890
+ observable.hasValue = () => hasValue;
4891
+ observable.getValue = () => currentValue;
4892
+ return observable;
4885
4893
  }
4886
4894
 
4887
4895
  let domDeps;
@@ -5037,6 +5045,9 @@ let propagatingLocally = false;
5037
5045
 
5038
5046
  if (typeof BroadcastChannel !== 'undefined') {
5039
5047
  const bc = new BroadcastChannel(STORAGE_MUTATED_DOM_EVENT_NAME);
5048
+ if (typeof bc.unref === 'function') {
5049
+ bc.unref();
5050
+ }
5040
5051
  globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, (changedParts) => {
5041
5052
  if (!propagatingLocally) {
5042
5053
  bc.postMessage(changedParts);