fix(core): update
This commit is contained in:
parent
068199b5e9
commit
6bd3bd4f37
2160
package-lock.json
generated
2160
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@ -9,19 +9,18 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/ --web)",
|
||||
"build": "(tsbuild --web)",
|
||||
"format": "(gitzone format)"
|
||||
"build": "(tsbuild --web)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.39",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^14.0.20",
|
||||
"tslint": "^6.1.2",
|
||||
"@gitzone/tsbuild": "^2.1.25",
|
||||
"@gitzone/tstest": "^1.0.44",
|
||||
"@pushrocks/tapbundle": "^3.2.9",
|
||||
"@types/node": "^14.11.1",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"idb": "^5.0.4"
|
||||
"idb": "^5.0.6"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
|
@ -6,7 +6,7 @@ let testWebstore: webstore.WebStore;
|
||||
tap.test('first test', async () => {
|
||||
testWebstore = new webstore.WebStore({
|
||||
dbName: 'mytest-db',
|
||||
storeName: 'mytest-store'
|
||||
storeName: 'mytest-store',
|
||||
});
|
||||
expect(testWebstore).to.be.instanceOf(webstore.WebStore);
|
||||
});
|
||||
@ -20,18 +20,16 @@ tap.test('should allow storing a string', async () => {
|
||||
expect(await testWebstore.get('mystring')).to.equal('heythere');
|
||||
});
|
||||
|
||||
|
||||
|
||||
tap.test('should allow storing an object', async () => {
|
||||
await testWebstore.set('testProp1', {
|
||||
wow: 'wowVal'
|
||||
wow: 'wowVal',
|
||||
});
|
||||
console.log(JSON.stringify(await testWebstore.get('testProp1')));
|
||||
});
|
||||
|
||||
tap.test('should overwrite a value', async () => {
|
||||
await testWebstore.set('testProp1', {
|
||||
wow: 'wowVal2'
|
||||
wow: 'wowVal2',
|
||||
});
|
||||
console.log(JSON.stringify(await testWebstore.get('testProp1')));
|
||||
});
|
||||
|
@ -1 +1 @@
|
||||
export * from './webstiore.classes.webstore';
|
||||
export * from './webstore.classes.webstore';
|
||||
|
@ -10,12 +10,11 @@ export class WebStore<T = any> {
|
||||
public objectStore: plugins.idb.IDBPObjectStore;
|
||||
public options: IWebStoreOptions;
|
||||
|
||||
|
||||
constructor(optionsArg: IWebStoreOptions) {
|
||||
this.options = optionsArg;
|
||||
}
|
||||
|
||||
public async init () {
|
||||
public async init() {
|
||||
this.db = await plugins.idb.openDB(this.options.dbName, 1, {
|
||||
upgrade: (db) => {
|
||||
db.createObjectStore(this.options.storeName);
|
@ -1,5 +1,3 @@
|
||||
import * as idb from 'idb';
|
||||
|
||||
export {
|
||||
idb
|
||||
}
|
||||
export { idb };
|
||||
|
Loading…
Reference in New Issue
Block a user