Add localforage, basic cache service
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import Service from '@ember/service';
|
||||
import * as localforage from 'localforage';
|
||||
|
||||
function createStore(name) {
|
||||
return localforage.createInstance({ name: `kredits:${name}` });
|
||||
}
|
||||
|
||||
export default class BrowserCacheService extends Service {
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.stores = {
|
||||
contributors: createStore('contributors'),
|
||||
contributions: createStore('contributions')
|
||||
}
|
||||
}
|
||||
|
||||
get contributors() {
|
||||
return this.stores.contributors;
|
||||
}
|
||||
|
||||
get contributions() {
|
||||
return this.stores.contributions;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user