fix(core): update

This commit is contained in:
Philipp Kunz 2020-10-17 16:44:53 +00:00
parent 40175dc4de
commit 7fb47d224e
4 changed files with 20 additions and 4 deletions

View File

@ -0,0 +1,11 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as webstore from '../ts/index';
let testTypedrequestcache: webstore.TypedrequestCache;
tap.test('first test', async () => {
testTypedrequestcache = new webstore.TypedrequestCache('https://test.lossless.com/typedrequest')
expect(testTypedrequestcache).to.be.instanceOf(webstore.TypedrequestCache);
});
tap.start();

View File

@ -1 +1,2 @@
export * from './webstore.classes.typedrequestcache';
export * from './webstore.classes.webstore';

View File

@ -5,10 +5,14 @@ import * as plugins from './webstore.plugins';
* a cache that can be used to store and retrieve typedrequests
*/
export class TypedrequestCache {
private webstore = new WebStore<plugins.typedrequestInterfaces.ITypedRequest>({
dbName: 'trStore',
storeName: 'trStore',
});
private webstore: WebStore;
constructor(domainArg = 'default') {
this.webstore = new WebStore<plugins.typedrequestInterfaces.ITypedRequest>({
dbName: 'trStore',
storeName: `trStore-${domainArg}`,
});
}
private buildKey(requestArg: plugins.typedrequestInterfaces.ITypedRequest) {
return plugins.smartjson.stringify({