Skip to content

Instantly share code, notes, and snippets.

@seriousme
Created March 13, 2015 19:21
Show Gist options
  • Save seriousme/fb1690a99e8b15ec42a9 to your computer and use it in GitHub Desktop.
Save seriousme/fb1690a99e8b15ec42a9 to your computer and use it in GitHub Desktop.
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