Skip to content
Permalink
Browse files

feat(storage): setEngine method to choose which storage option you wo…

…uld like to use
  • Loading branch information...
jgw96 committed Sep 30, 2016
1 parent c5a94d8 commit b45e23d74e73745021da20ff81299892f3c7f8af
Showing with 12 additions and 0 deletions.
  1. +12 −0 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') {

This comment has been minimized.

Copy link
@mlynch

mlynch Sep 30, 2016

Member

Why the if? Localforage accepts arbitrary engines (for example, the SQLite driver)

console.error('Engine not recognized, engine choices are INDEXEDDB, WEBSQL and LOCALSTORAGE');
} else {
this._db.setDriver(this._db.engine);
}
}

}

0 comments on commit b45e23d

Please sign in to comment.
You can’t perform that action at this time.