Created
March 13, 2015 19:21
-
-
Save seriousme/fb1690a99e8b15ec42a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var defaultPersistence={ 'NODEJS': 'fs', 'BROWSER': 'localStorage', 'CORDOVA': null }; | |
if (this.persistenceMethod == null){ | |
this.persistenceMethod = defaultPersistence[this.ENV]; | |
if (! this.persistenceMethod){ | |
throw Error('unknown environment') | |
} | |
} | |
if (this.persistenceMethod === 'adapter') { | |
if ( this.persistenceAdapter ) == null; | |
throw Error('persistenceAdapter not configured') | |
} | |
if ( this.persistenceMethod === 'fs') { | |
this.persistenceAdapter = new lokiFsAdapter; | |
} | |
if this.persistenceMethod === 'localStorage' { | |
this.persistenceAdapter = new lokiLocalStorageAdapter; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment