Skip to content

Commit

Permalink
chore: Release 1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tofumatt committed Aug 18, 2021
1 parent ff5e392 commit 7323475
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,10 @@
This file will include all API breakage, new features, and upgrade info in
localForage's lifetime.

### [1.10.0](https://github.com/localForage/localForage/releases/tag/1.10.0)

* Avoid uncaught error in `dropInstance`. You can now catch errors thrown by `dropInstance`, see #807.

### [1.9.0](https://github.com/mozilla/localForage/releases/tag/1.9.0)

* Fixed TypeScript definition for `getItem`. It now notes that `getItem` can return `null`, so this change may cause TypeScript code that didn't account for `null` values to fail. See #980.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -4,7 +4,7 @@
[![Dependency Status](https://img.shields.io/david/localForage/localForage.svg)](https://david-dm.org/localForage/localForage)
[![npm](https://img.shields.io/npm/dm/localforage.svg?maxAge=2592000)](https://npmcharts.com/compare/localforage?minimal=true)
[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/localforage/badge?style=rounded)](https://www.jsdelivr.com/package/npm/localforage)
[![minzipped size](https://badgen.net/bundlephobia/minzip/localforage)](https://bundlephobia.com/result?p=localforage@1.9.0)
[![minzipped size](https://badgen.net/bundlephobia/minzip/localforage)](https://bundlephobia.com/result?p=localforage@1.10.0)

localForage is a fast and simple storage library for JavaScript. localForage
improves the offline experience of your web app by using asynchronous storage
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -23,5 +23,5 @@
"assert": "~0.1.0",
"modernizr": "~2.8.1"
},
"version": "1.9.0"
"version": "1.10.0"
}
2 changes: 1 addition & 1 deletion component.json
@@ -1,6 +1,6 @@
{
"name": "localforage",
"version": "1.9.0",
"version": "1.10.0",
"dependencies": {
"then/promise": "5.0.0"
},
Expand Down
23 changes: 19 additions & 4 deletions dist/localforage.js
@@ -1,6 +1,6 @@
/*!
localForage -- Offline Storage, Improved
Version 1.9.0
Version 1.10.0
https://localforage.github.io/localForage
(c) 2013-2017 Mozilla, Apache License 2.0
*/
Expand Down Expand Up @@ -650,7 +650,16 @@ function _getConnection(dbInfo, upgradeNeeded) {
};

openreq.onsuccess = function () {
resolve(openreq.result);
var db = openreq.result;
db.onversionchange = function (e) {
// Triggered when the database is modified (e.g. adding an objectStore) or
// deleted (even when initiated by other sessions in different tabs).
// Closing the connection here prevents those operations from being blocked.
// If the database is accessed again later by this instance, the connection
// will be reopened or the database recreated as needed.
e.target.close();
};
resolve(db);
_advanceReadiness(dbInfo);
};
});
Expand Down Expand Up @@ -1326,12 +1335,18 @@ function dropInstance(options, callback) {
var dropDBPromise = new Promise$1(function (resolve, reject) {
var req = idb.deleteDatabase(options.name);

req.onerror = req.onblocked = function (err) {
req.onerror = function () {
var db = req.result;
if (db) {
db.close();
}
reject(err);
reject(req.error);
};

req.onblocked = function () {
// Closing all open connections in onversionchange handler should prevent this situation, but if
// we do get here, it just means the request remains pending - eventually it will succeed or error
console.warn('dropInstance blocked for database "' + options.name + '" until all open connections are closed');
};

req.onsuccess = function () {
Expand Down
4 changes: 2 additions & 2 deletions dist/localforage.min.js

Large diffs are not rendered by default.

23 changes: 19 additions & 4 deletions dist/localforage.nopromises.js
@@ -1,6 +1,6 @@
/*!
localForage -- Offline Storage, Improved
Version 1.9.0
Version 1.10.0
https://localforage.github.io/localForage
(c) 2013-2017 Mozilla, Apache License 2.0
*/
Expand Down Expand Up @@ -314,7 +314,16 @@ function _getConnection(dbInfo, upgradeNeeded) {
};

openreq.onsuccess = function () {
resolve(openreq.result);
var db = openreq.result;
db.onversionchange = function (e) {
// Triggered when the database is modified (e.g. adding an objectStore) or
// deleted (even when initiated by other sessions in different tabs).
// Closing the connection here prevents those operations from being blocked.
// If the database is accessed again later by this instance, the connection
// will be reopened or the database recreated as needed.
e.target.close();
};
resolve(db);
_advanceReadiness(dbInfo);
};
});
Expand Down Expand Up @@ -990,12 +999,18 @@ function dropInstance(options, callback) {
var dropDBPromise = new Promise$1(function (resolve, reject) {
var req = idb.deleteDatabase(options.name);

req.onerror = req.onblocked = function (err) {
req.onerror = function () {
var db = req.result;
if (db) {
db.close();
}
reject(err);
reject(req.error);
};

req.onblocked = function () {
// Closing all open connections in onversionchange handler should prevent this situation, but if
// we do get here, it just means the request remains pending - eventually it will succeed or error
console.warn('dropInstance blocked for database "' + options.name + '" until all open connections are closed');
};

req.onsuccess = function () {
Expand Down
4 changes: 2 additions & 2 deletions dist/localforage.nopromises.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -9,7 +9,7 @@
"storage",
"websql"
],
"version": "1.9.0",
"version": "1.10.0",
"homepage": "https://github.com/localForage/localForage",
"repository": {
"type": "git",
Expand Down

0 comments on commit 7323475

Please sign in to comment.