@browser-storage/websql-driver
Advanced tools
Comparing version 0.0.1-beta.3 to 0.0.1-beta.4
@@ -79,4 +79,5 @@ 'use strict'; | ||
})(); | ||
} | ||
} // tslint:disable-next-line | ||
destroy() { | ||
@@ -83,0 +84,0 @@ return _asyncToGenerator(function* () {})(); |
@@ -0,3 +1,3 @@ | ||
import { Defer } from '@browser-storage/core'; | ||
import { WebsqlSerializer } from './websql-serializer'; | ||
import { Defer } from "@browser-storage/core"; | ||
export class WebsqlDriver { | ||
@@ -16,2 +16,3 @@ constructor({ description, size }) { | ||
} | ||
// tslint:disable-next-line | ||
async destroy() { | ||
@@ -18,0 +19,0 @@ } |
import { BrowserStorage } from '@browser-storage/core'; | ||
import { WebsqlDriver } from './websql-driver'; | ||
// @ts-ignore | ||
// tslint:disable-next-line | ||
const openDatabase = require('websql'); | ||
@@ -5,0 +6,0 @@ window.openDatabase = openDatabase; |
@@ -72,6 +72,7 @@ import { Defer } from '@browser-storage/core'; | ||
return _asyncToGenerator(function* () { | ||
yield _this._executeSql(`DELETE FROM ${_this.options.storeName}`); | ||
yield _this._executeSql("DELETE FROM ".concat(_this.options.storeName)); | ||
})(); | ||
} | ||
} // tslint:disable-next-line | ||
destroy() { | ||
@@ -85,3 +86,3 @@ return _asyncToGenerator(function* () {})(); | ||
return _asyncToGenerator(function* () { | ||
const result = yield _this2._executeSql(`SELECT * FROM ${_this2.options.storeName} WHERE key = ? LIMIT 1`, [key]); | ||
const result = yield _this2._executeSql("SELECT * FROM ".concat(_this2.options.storeName, " WHERE key = ? LIMIT 1"), [key]); | ||
return _this2._serializer.deserialize(result.rows.item(0).value); | ||
@@ -105,3 +106,3 @@ })(); | ||
_this4.db = _this4._createDB(); | ||
yield _this4._executeSql(`CREATE TABLE IF NOT EXISTS ${_this4.options.storeName} (id INTEGER PRIMARY KEY, key unique, value)`); | ||
yield _this4._executeSql("CREATE TABLE IF NOT EXISTS ".concat(_this4.options.storeName, " (id INTEGER PRIMARY KEY, key unique, value)")); | ||
@@ -145,3 +146,3 @@ _this4._ready.resolve(true); | ||
return _asyncToGenerator(function* () { | ||
const result = yield _this7._executeSql(`SELECT key FROM ${_this7.options.storeName} as a order by id`); | ||
const result = yield _this7._executeSql("SELECT key FROM ".concat(_this7.options.storeName, " as a order by id")); | ||
const keys = []; | ||
@@ -161,3 +162,3 @@ | ||
return _asyncToGenerator(function* () { | ||
const result = yield _this8._executeSql(`SELECT COUNT(key) as count FROM ${_this8.options.storeName}`); | ||
const result = yield _this8._executeSql("SELECT COUNT(key) as count FROM ".concat(_this8.options.storeName)); | ||
return result.rows.item(0).count; | ||
@@ -175,3 +176,3 @@ })(); | ||
return _asyncToGenerator(function* () { | ||
yield _this9._executeSql(`DELETE FROM ${_this9.options.storeName} WHERE key = ?`, [key]); | ||
yield _this9._executeSql("DELETE FROM ".concat(_this9.options.storeName, " WHERE key = ?"), [key]); | ||
})(); | ||
@@ -184,3 +185,3 @@ } | ||
return _asyncToGenerator(function* () { | ||
yield _this10._executeSql(`INSERT OR REPLACE INTO ${_this10.options.storeName} (key, value) VALUES (?, ?)`, [key, yield _this10._serializer.serialize(item)]); | ||
yield _this10._executeSql("INSERT OR REPLACE INTO ".concat(_this10.options.storeName, " (key, value) VALUES (?, ?)"), [key, yield _this10._serializer.serialize(item)]); | ||
return item; | ||
@@ -187,0 +188,0 @@ })(); |
{ | ||
"name": "@browser-storage/websql-driver", | ||
"description": "Web SQL driver for BrowserStorage", | ||
"version": "0.0.1-beta.3", | ||
"version": "0.0.1-beta.4", | ||
"license": "MIT", | ||
"files": [ | ||
"dist-*/", | ||
"bin/" | ||
], | ||
"source": "dist-src/index.js", | ||
@@ -22,7 +26,2 @@ "types": "dist-types/index.d.ts", | ||
], | ||
"files": [ | ||
"dist-*/", | ||
"assets/", | ||
"bin/" | ||
], | ||
"homepage": "https://github.com/browser-storage/browser-storage/tree/master/packages/websql-driver#readme", | ||
@@ -37,4 +36,4 @@ "bugs": { | ||
"dependencies": { | ||
"@browser-storage/core": "^0.0.1-beta.3", | ||
"@browser-storage/typings": "^0.0.1-beta.1" | ||
"@browser-storage/core": "^0.0.1-beta.4", | ||
"@browser-storage/typings": "^0.0.1-beta.4" | ||
}, | ||
@@ -41,0 +40,0 @@ "devDependencies": { |
# `@browser-storage/websql-driver` | ||
>The tool is in deep alpha and is not intended for use in production. | ||
>The tool is in beta. Use it with caution. | ||
>[More info](https://github.com/browser-storage/browser-storage) |
20056
584