Skip to content

Instantly share code, notes, and snippets.

@idoshamun
Created October 8, 2018 15:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idoshamun/4145dc63ddc43c824c18ce56f6034b7b to your computer and use it in GitHub Desktop.
Save idoshamun/4145dc63ddc43c824c18ce56f6034b7b to your computer and use it in GitHub Desktop.
Optimistic Offline-First Apps With Vuex
import store from './store';
import { getState } from './storage';
export default function () {
if (store.initialized) {
return Promise.resolve();
}
return getState()
.then(state => store.commit('loadFromCache', state));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment