Skip to content

Commit 49892db

Browse files
docs: add classes description.
1 parent 4faa28c commit 49892db

File tree

7 files changed

+41
-41
lines changed

7 files changed

+41
-41
lines changed

src/lib/idb-connection.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { IDBStoreParameters } from './type/idb-store-parameters.type';
33

44
/**
5-
*
5+
* Class to open connection and create object store.
66
*/
77
export class IDBConnection<
88
Name extends string = string,

src/lib/idb-data.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { IDBConnection } from './idb-connection.class';
55
import { IDBStoreParameters } from './type/idb-store-parameters.type';
66

77
/**
8-
*
8+
* Class with opened connection (IDBConnection), to handle transaction and store.
99
*/
1010
export class IDBData<
1111
Name extends string = string,

src/lib/idb-query.class.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { IDBRangeBound } from './type/query/idb-range-bound.type';
1414
import { IDBConfig } from './interface/idb-config.interface';
1515

1616
/**
17-
*
17+
* Query store with JSON, by method-store or store-method.
1818
*/
1919
export class IDBQuery<
2020
StoreSchema extends object,
@@ -264,6 +264,39 @@ export class IDBQuery<
264264
return this;
265265
}
266266

267+
/**
268+
*
269+
*/
270+
public method(
271+
{ }: IDBQueryMethod_Store<StoreSchema, StoreNames>,
272+
complete?: () => void,
273+
error?: (err: any) => void,
274+
): this {
275+
of(arguments[0] as IDBQueryMethod_Store<StoreSchema, StoreNames>)
276+
.subscribe({
277+
next: query =>
278+
this.#queryMethod(query, method => {
279+
if (query[method]) {
280+
const queryStore = query[method];
281+
if (queryStore) {
282+
(Object
283+
.keys(queryStore) as Array<keyof typeof queryStore>)
284+
.forEach(storeName => {
285+
this.#performMethod(method, {
286+
...{ storeName },
287+
...queryStore[storeName]
288+
} as any)
289+
});
290+
}
291+
}
292+
}
293+
),
294+
complete,
295+
error
296+
})
297+
return this;
298+
}
299+
267300
/**
268301
*
269302
* @param param0
@@ -299,39 +332,6 @@ export class IDBQuery<
299332
return this;
300333
}
301334

302-
/**
303-
*
304-
*/
305-
public method(
306-
{ }: IDBQueryMethod_Store<StoreSchema, StoreNames>,
307-
complete?: () => void,
308-
error?: (err: any) => void,
309-
): this {
310-
of(arguments[0] as IDBQueryMethod_Store<StoreSchema, StoreNames>)
311-
.subscribe({
312-
next: query =>
313-
this.#queryMethod(query, method => {
314-
if (query[method]) {
315-
const queryStore = query[method];
316-
if (queryStore) {
317-
(Object
318-
.keys(queryStore) as Array<keyof typeof queryStore>)
319-
.forEach(storeName => {
320-
this.#performMethod(method, {
321-
...{ storeName },
322-
...queryStore[storeName]
323-
} as any)
324-
});
325-
}
326-
}
327-
}
328-
),
329-
complete,
330-
error
331-
})
332-
return this;
333-
}
334-
335335
/**
336336
*
337337
* @param param0

src/lib/idb.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { IDBStoreParameters } from "./type/idb-store-parameters.type";
33

44
/**
5-
*
5+
* IDB configuration used in Angular IDBModule.
66
*/
77
export class IDBConfig<
88
Name extends string = string,

src/lib/idb.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { IDBService } from './idb.service';
88
import { IDBConfig } from './idb.config';
99

1010
/**
11-
*
11+
* Angular Module with indexeddb service.
1212
*/
1313
@NgModule({
1414
declarations: [],

src/lib/idb.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { IDBConfig } from "./idb.config";
1010
import { IDBStoreParameters } from "./type/idb-store-parameters.type";
1111

1212
/**
13-
*
13+
* Angular Service with IndexedDB class.
1414
*/
1515
@Injectable({
1616
providedIn: "root",

src/lib/inexeddb.class.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { IDBConfig } from './interface/idb-config.interface';
1111
import { IDBStoreParameters } from './type/idb-store-parameters.type';
1212

1313
/**
14-
*
14+
* Store and query for IndexedDB client-side storage.
1515
*/
1616
export class IndexedDB<
1717
StoreSchema extends object,
@@ -108,7 +108,7 @@ export class IndexedDB<
108108
ev => onOpenSuccess(
109109
this,
110110
this.#query.objectStore,
111-
this.#query.objectStore.database,
111+
this.#query.objectStore.data,
112112
this.connection,
113113
this.connection.request,
114114
ev

0 commit comments

Comments
 (0)