dexie 1.5.0 → 1.5.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.
package/bower.json CHANGED
@@ -31,5 +31,5 @@
31
31
  "test",
32
32
  "tools"
33
33
  ],
34
- "version": "1.5.0"
34
+ "version": "1.5.1"
35
35
  }
package/dist/dexie.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for Dexie v1.5.0
1
+ // Type definitions for Dexie v1.5.1
2
2
  // Project: https://github.com/dfahlander/Dexie.js
3
3
  // Definitions by: David Fahlander <http://github.com/dfahlander>
4
4
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
package/dist/dexie.es6.js CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 1.5.0, Thu Oct 13 2016
7
+ * Version 1.5.1, Tue Nov 01 2016
8
8
  * www.dexie.com
9
9
  * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
10
10
  */
@@ -1417,14 +1417,14 @@ function rejection (err, uncaughtHandler) {
1417
1417
  *
1418
1418
  * By David Fahlander, david.fahlander@gmail.com
1419
1419
  *
1420
- * Version 1.5.0, Thu Oct 13 2016
1420
+ * Version 1.5.1, Tue Nov 01 2016
1421
1421
  *
1422
1422
  * http://dexie.org
1423
1423
  *
1424
1424
  * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
1425
1425
  */
1426
1426
 
1427
- var DEXIE_VERSION = '1.5.0';
1427
+ var DEXIE_VERSION = '1.5.1';
1428
1428
  var maxString = String.fromCharCode(65535);
1429
1429
  var maxKey = (function(){try {IDBKeyRange.only([[]]);return [[]];}catch(e){return maxString;}})();
1430
1430
  var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -2768,8 +2768,8 @@ function Dexie(dbName, options) {
2768
2768
  if (--this._reculock === 0) {
2769
2769
  if (!PSD.global) PSD.lockOwnerFor = null;
2770
2770
  while (this._blockedFuncs.length > 0 && !this._locked()) {
2771
- var fn = this._blockedFuncs.shift();
2772
- try { fn(); } catch (e) { }
2771
+ var fnAndPSD = this._blockedFuncs.shift();
2772
+ try { usePSD(fnAndPSD[1], fnAndPSD[0]); } catch (e) { }
2773
2773
  }
2774
2774
  }
2775
2775
  return this;
@@ -2824,31 +2824,29 @@ function Dexie(dbName, options) {
2824
2824
  },
2825
2825
  _promise: function (mode, fn, bWriteLock) {
2826
2826
  var self = this;
2827
- return newScope(function() {
2828
- var p;
2829
- // Read lock always
2830
- if (!self._locked()) {
2831
- p = self.active ? new Promise(function (resolve, reject) {
2827
+ var p = self._locked() ?
2828
+ // Read lock always. Transaction is write-locked. Wait for mutex.
2829
+ new Promise(function (resolve, reject) {
2830
+ self._blockedFuncs.push([function () {
2831
+ self._promise(mode, fn, bWriteLock).then(resolve, reject);
2832
+ }, PSD]);
2833
+ }) :
2834
+ newScope(function() {
2835
+ var p_ = self.active ? new Promise(function (resolve, reject) {
2832
2836
  if (mode === READWRITE && self.mode !== READWRITE)
2833
2837
  throw new exceptions.ReadOnly("Transaction is readonly");
2834
2838
  if (!self.idbtrans && mode) self.create();
2835
2839
  if (bWriteLock) self._lock(); // Write lock if write operation is requested
2836
2840
  fn(resolve, reject, self);
2837
2841
  }) : rejection(new exceptions.TransactionInactive());
2838
- if (self.active && bWriteLock) p.finally(function () {
2842
+ if (self.active && bWriteLock) p_.finally(function () {
2839
2843
  self._unlock();
2840
2844
  });
2841
- } else {
2842
- // Transaction is write-locked. Wait for mutex.
2843
- p = new Promise(function (resolve, reject) {
2844
- self._blockedFuncs.push(function () {
2845
- self._promise(mode, fn, bWriteLock).then(resolve, reject);
2846
- });
2847
- });
2848
- }
2849
- p._lib = true;
2850
- return p.uncaught(dbUncaught);
2851
- });
2845
+ return p_;
2846
+ });
2847
+
2848
+ p._lib = true;
2849
+ return p.uncaught(dbUncaught);
2852
2850
  },
2853
2851
 
2854
2852
  //