@cocreate/indexeddb 1.5.33 → 1.6.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.6.0](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.5.34...v1.6.0) (2023-01-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * indexeddb status ([7ba7ef5](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/7ba7ef589509f8e9cbc18aeac511ee6d62040468))
7
+
8
+ ## [1.5.34](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.5.33...v1.5.34) (2023-01-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump dependencies ([a253778](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/a253778edeb211f01782e6d1fd8ce958101ffa13))
14
+
1
15
  ## [1.5.33](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.5.32...v1.5.33) (2023-01-27)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/indexeddb",
3
- "version": "1.5.33",
3
+ "version": "1.6.0",
4
4
  "description": "A simple indexeddb component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "indexeddb",
package/src/index.js CHANGED
@@ -5,6 +5,7 @@
5
5
  * SPDX-License-Identifier: MIT
6
6
  ********************************************************************************/
7
7
  import {ObjectId, dotNotationToObject, searchData, sortData, queryData} from '@cocreate/utils'
8
+ const status = true;
8
9
 
9
10
  function createDatabase(data){
10
11
  return Database('createDatabase', data)
@@ -1163,13 +1164,38 @@ function init() {
1163
1164
  // Check for support.
1164
1165
  if (!('indexedDB' in window)) {
1165
1166
  console.log("This browser doesn't support IndexedDB.");
1167
+ setStatus(false);
1166
1168
  return;
1167
- } else { }
1168
- }
1169
+ } else {
1170
+ try {
1171
+ let openRequest = indexedDB.open('database');
1172
+ openRequest.onsuccess = function() {
1173
+ let db = openRequest.result;
1174
+ db.close()
1175
+ }
1176
+ if (window.CoCreateConfig)
1177
+ if (window.CoCreateConfig.indexeddb !== false)
1178
+ setStatus(true)
1179
+ } catch(e) {
1180
+ setStatus(false);
1181
+ }
1182
+ }
1183
+ }
1184
+
1185
+ function setStatus(value) {
1186
+ if (window.CoCreateConfig)
1187
+ window.CoCreateConfig.indexeddb = value;
1188
+ else
1189
+ window.CoCreateConfig = {indexeddb: value};
1190
+
1191
+ status = value;
1192
+ }
1193
+
1169
1194
 
1170
1195
  init();
1171
1196
 
1172
1197
  export default {
1198
+ status,
1173
1199
  ObjectId,
1174
1200
  getDatabase,
1175
1201
  createDatabase,