chore(storage): move storage out of platform

This commit is contained in:
Adam Bradley
2016-09-13 16:40:13 -05:00
parent 93fc30793d
commit a154d837a0
4 changed files with 6 additions and 9 deletions

View File

@ -1,3 +0,0 @@
export * from './storage/storage'
export * from './storage/local-storage'
export * from './storage/sql'

View File

@ -1,6 +1,6 @@
import { StorageEngine } from './storage'; import { StorageEngine } from './storage';
import { defaults, assign } from '../../util/util'; import { defaults, assign } from '../util/util';
const DB_NAME: string = '__ionicstorage'; const DB_NAME: string = '__ionicstorage';
const win: any = window; const win: any = window;
@ -98,15 +98,15 @@ export class SqlStorage extends StorageEngine {
* @param {array} params the additional params to use for query placeholders * @param {array} params the additional params to use for query placeholders
* @return {Promise} that resolves or rejects with an object of the form { tx: Transaction, res: Result (or err)} * @return {Promise} that resolves or rejects with an object of the form { tx: Transaction, res: Result (or err)}
*/ */
query(query: string, params = []): Promise<any> { query(query: string, params: any[] = []): Promise<any> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
this._db.transaction((tx) => { this._db.transaction((tx: any) => {
tx.executeSql(query, params, tx.executeSql(query, params,
(tx, res) => resolve({ tx: tx, res: res }), (tx: any, res: any) => resolve({ tx: tx, res: res }),
(tx, err) => reject({ tx: tx, err: err })); (tx: any, err: any) => reject({ tx: tx, err: err }));
}, },
(err) => reject({ err: err })); (err: any) => reject({ err: err }));
} catch (err) { } catch (err) {
reject({ err: err }); reject({ err: err });
} }