From b45e23d74e73745021da20ff81299892f3c7f8af Mon Sep 17 00:00:00 2001 From: Justin Willis Date: Fri, 30 Sep 2016 11:33:18 -0500 Subject: [PATCH] feat(storage): setEngine method to choose which storage option you would like to use --- src/storage.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/storage.ts b/src/storage.ts index c7a3d36..96dbfcf 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -109,4 +109,16 @@ export class Storage { return this._db.iterate(iteratorCallback); } + /** + * Set storage engine + * @param engine engine allows you to specify a specific storage engine to use. Can be INDEXEDB, WEBSQL or LOCALSTORAGE + */ + setEngine(engine: string) { + if (engine !== 'INDEXEDB' || engine !== 'WEBSQL' || engine !== 'LOCALSTORAGE') { + console.error('Engine not recognized, engine choices are INDEXEDDB, WEBSQL and LOCALSTORAGE'); + } else { + this._db.setDriver(this._db.engine); + } + } + }