Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
ad95154284 | |||
7fb47d224e |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/webstore",
|
"name": "@pushrocks/webstore",
|
||||||
"version": "1.0.15",
|
"version": "1.0.16",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/webstore",
|
"name": "@pushrocks/webstore",
|
||||||
"version": "1.0.15",
|
"version": "1.0.16",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "high performance storage in the browser using indexed db",
|
"description": "high performance storage in the browser using indexed db",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
11
test/test.typedrequestcache.browser.ts
Normal file
11
test/test.typedrequestcache.browser.ts
Normal 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();
|
@ -1 +1,2 @@
|
|||||||
|
export * from './webstore.classes.typedrequestcache';
|
||||||
export * from './webstore.classes.webstore';
|
export * from './webstore.classes.webstore';
|
||||||
|
@ -5,10 +5,14 @@ import * as plugins from './webstore.plugins';
|
|||||||
* a cache that can be used to store and retrieve typedrequests
|
* a cache that can be used to store and retrieve typedrequests
|
||||||
*/
|
*/
|
||||||
export class TypedrequestCache {
|
export class TypedrequestCache {
|
||||||
private webstore = new WebStore<plugins.typedrequestInterfaces.ITypedRequest>({
|
private webstore: WebStore;
|
||||||
dbName: 'trStore',
|
|
||||||
storeName: 'trStore',
|
constructor(domainArg = 'default') {
|
||||||
});
|
this.webstore = new WebStore<plugins.typedrequestInterfaces.ITypedRequest>({
|
||||||
|
dbName: 'trStore',
|
||||||
|
storeName: `trStore-${domainArg}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private buildKey(requestArg: plugins.typedrequestInterfaces.ITypedRequest) {
|
private buildKey(requestArg: plugins.typedrequestInterfaces.ITypedRequest) {
|
||||||
return plugins.smartjson.stringify({
|
return plugins.smartjson.stringify({
|
||||||
|
Reference in New Issue
Block a user