vue-offline
Advanced tools
Comparing version 2.0.6 to 2.0.7
{ | ||
"name": "vue-offline", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "Offline states and storage for Vue.js apps and Progressive Web Apps", | ||
@@ -5,0 +5,0 @@ "main": "lib/vue-offline.js", |
@@ -91,3 +91,3 @@ # Vue Offline | ||
### VueOfflineStorage | ||
Offline storaga that uses [local storage][https://developer.mozilla.org/pl/docs/Web/API/Window/localStorage] to persist data for offline usage and caching. It's a perfect choice for offline-first PWA. You can use it as a fallback for failed network requests or a local cache. | ||
Offline storage that uses [local storage](https://developer.mozilla.org/pl/docs/Web/API/Window/localStorage) to persist data for offline usage and caching. It's a perfect choice for offline-first PWA. You can use it as a fallback for failed network requests or a local cache. | ||
@@ -94,0 +94,0 @@ The storage object has following properties: |
@@ -15,3 +15,3 @@ /* ----------------------- Mixin ------------------------ */ | ||
mounted () { | ||
if (typeof window !== undefined) { | ||
if (typeof window !== 'undefined') { | ||
navigator.onLine ? this.isOnline = true : this.isOffline = true | ||
@@ -52,5 +52,5 @@ | ||
export const VueOfflineStorage = { | ||
keys: typeof window !== undefined ? localStorage.getItem('VueOfflineStorageKeys') : null, | ||
keys: typeof window !== 'undefined' ? localStorage.getItem('VueOfflineStorageKeys') : null, | ||
set (key, value) { | ||
if ( typeof window !== undefined ) { | ||
if ( typeof window !== 'undefined' ) { | ||
localStorage.setItem(key, JSON.stringify(value)) | ||
@@ -61,3 +61,3 @@ _addKey(key) | ||
get (key) { | ||
return typeof window !== undefined ? JSON.parse(localStorage.getItem(key)) : null | ||
return typeof window !== 'undefined' ? JSON.parse(localStorage.getItem(key)) : null | ||
} | ||
@@ -64,0 +64,0 @@ } |
229112