universe-code 0.0.71 → 0.0.73
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/dist/angular/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { IdbService } from './indexdb/services/idbService.
|
|
2
|
-
export { IDB_CONFIG } from './indexdb/services/idb.config.mjs';
|
|
1
|
+
export { IdbService } from './indexdb/services/idbService.js';
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import { DBManager, DB } from 'universe-code';
|
|
3
|
-
import { inject } from '@angular/core';
|
|
4
|
-
import { IDB_CONFIG } from './idb.config.mjs';
|
|
1
|
+
import { DBManager, DB } from "universe-code";
|
|
5
2
|
|
|
6
3
|
export class IdbService {
|
|
7
4
|
db = null;
|
|
8
5
|
manager = null;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
isBrowser = typeof window !== "undefined";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {Object} config - { dbName, version, storeName }
|
|
10
|
+
*/
|
|
11
|
+
constructor(config) {
|
|
12
|
+
if (!config) throw new Error("IDB config is required");
|
|
13
|
+
this.options = config;
|
|
14
|
+
}
|
|
13
15
|
|
|
14
16
|
async connect() {
|
|
15
17
|
if (!this.isBrowser) return null;
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// idb.config.ts
|
|
2
|
-
import { InjectionToken } from '@angular/core';
|
|
3
|
-
|
|
4
|
-
/** @typedef {Object} IdbConfig
|
|
5
|
-
* @property {string} dbName
|
|
6
|
-
* @property {number} version
|
|
7
|
-
* @property {string} storeName
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export const IDB_CONFIG = new InjectionToken<IdbConfig>('IDB_CONFIG');
|