1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-06-10 01:42:26 +02:00
TableFilter/src/modules/storage.js
2016-04-07 12:13:54 +02:00

32 lines
662 B
JavaScript

const global = window;
// const JSON = global.JSON;
export const hasStorage = () => {
return 'Storage' in global;
};
export class Storage {
constructor(state){
this.state = state;
this.enableLocalStorage = state.enableLocalStorage && hasStorage();
this.enableCookie = state.enableCookie;
this.emitter = state.emitter;
}
init(){
this.emitter.on(['state-changed'], (tf, state) => this.update(state));
// this.emitter.on(['initialized'], () => this.sync());
}
update(state){
console.log(this.enableLocalStorage, this.enableCookie, state);
}
// save(state){
// }
}