Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 b45e23d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/storage.ts
Expand Up @@ -109,4 +109,16 @@ export class Storage {
return this._db.iterate(iteratorCallback); 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

Contributor

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.