Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-offline

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-offline - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

63

lib/vue-offline.js

@@ -111,2 +111,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VueOfflinePlugin", function() { return VueOfflinePlugin; });
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/* ----------------------- Mixin ------------------------ */

@@ -118,4 +120,4 @@

* */
const VueOfflineMixin = {
data() {
var VueOfflineMixin = {
data: function data() {
return {

@@ -126,17 +128,20 @@ isOnline: false,

},
mounted: function mounted() {
var _this = this;
mounted() {
if (typeof window !== undefined) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined) {
navigator.onLine ? this.isOnline = true : this.isOffline = true;
const onlineHandler = () => {
this.$emit('online');
this.isOnline = true;
this.isOffline = false;
var onlineHandler = function onlineHandler() {
_this.$emit('online');
_this.isOnline = true;
_this.isOffline = false;
};
const offlineHandler = () => {
this.$emit('offline');
this.isOffline = true;
this.isOnline = false;
var offlineHandler = function offlineHandler() {
_this.$emit('offline');
_this.isOffline = true;
_this.isOnline = false;
};

@@ -146,3 +151,3 @@

window.addEventListener('offline', offlineHandler);
this.$once('hook:beforeDestroy', () => {
this.$once('hook:beforeDestroy', function () {
window.removeEventListener('online', onlineHandler);

@@ -153,3 +158,2 @@ window.removeEventListener('offline', offlineHandler);

}
};

@@ -159,3 +163,3 @@ /* ----------------------- Storage ------------------------ */

function _addKey(newKey) {
let keys = JSON.parse(localStorage.getItem('VueOfflineStorageKeys')) || [];
var keys = JSON.parse(localStorage.getItem('VueOfflineStorageKeys')) || [];
keys.push(newKey);

@@ -167,7 +171,6 @@ localStorage.setItem('VueOfflineStorageKeys', JSON.stringify(keys));

const VueOfflineStorage = {
keys: typeof window !== undefined ? localStorage.getItem('VueOfflineStorageKeys') : null,
set(key, value) {
if (typeof window !== undefined) {
var VueOfflineStorage = {
keys: (typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined ? localStorage.getItem('VueOfflineStorageKeys') : null,
set: function set(key, value) {
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined) {
localStorage.setItem(key, value);

@@ -178,7 +181,5 @@

},
get(key) {
typeof window !== undefined ? JSON.parse(localStorage.getItem(key)) : null;
get: function get(key) {
(typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined ? JSON.parse(localStorage.getItem(key)) : null;
}
};

@@ -192,8 +193,9 @@ /* ----------------------- Plugin ------------------------ */

const VueOfflinePlugin = {
install(Vue, options = {
mixin: true,
storage: true
}) {
const pluginOptions = {
var VueOfflinePlugin = {
install: function install(Vue) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
mixin: true,
storage: true
};
var pluginOptions = {
mixin: options.mixin,

@@ -205,3 +207,2 @@ storage: options.storage

}
};

@@ -208,0 +209,0 @@ /* harmony default export */ __webpack_exports__["default"] = (VueOfflinePlugin);

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue-offline",[],t):"object"==typeof exports?exports["vue-offline"]=t():e["vue-offline"]=t()}(window,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"VueOfflineMixin",function(){return o}),n.d(t,"VueOfflineStorage",function(){return i}),n.d(t,"VueOfflinePlugin",function(){return r});const o={data:()=>({isOnline:!1,isOffline:!1}),mounted(){if(void 0!==typeof window){navigator.onLine?this.isOnline=!0:this.isOffline=!0;const e=()=>{this.$emit("online"),this.isOnline=!0,this.isOffline=!1},t=()=>{this.$emit("offline"),this.isOffline=!0,this.isOnline=!1};window.addEventListener("online",e),window.addEventListener("offline",t),this.$once("hook:beforeDestroy",()=>{window.removeEventListener("online",e),window.removeEventListener("offline",t)})}}};const i={keys:void 0!==typeof window?localStorage.getItem("VueOfflineStorageKeys"):null,set(e,t){void 0!==typeof window&&(localStorage.setItem(e,t),function(e){let t=JSON.parse(localStorage.getItem("VueOfflineStorageKeys"))||[];t.push(e),localStorage.setItem("VueOfflineStorageKeys",JSON.stringify(t))}(e))},get(e){void 0!==typeof window&&JSON.parse(localStorage.getItem(e))}},r={install(e,t={mixin:!0,storage:!0}){const n=t.mixin;t.storage&&(e.prototype.$offlineStorage=i),n&&e.mixin(o)}};t.default=r}])});
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("vue-offline",[],n):"object"==typeof exports?exports["vue-offline"]=n():e["vue-offline"]=n()}(window,function(){return function(e){var n={};function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var i in e)t.d(o,i,function(n){return e[n]}.bind(null,i));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.r(n),t.d(n,"VueOfflineMixin",function(){return i}),t.d(n,"VueOfflineStorage",function(){return r}),t.d(n,"VueOfflinePlugin",function(){return f});var i={data:function(){return{isOnline:!1,isOffline:!1}},mounted:function(){var e=this;if(void 0!==("undefined"==typeof window?"undefined":o(window))){navigator.onLine?this.isOnline=!0:this.isOffline=!0;var n=function(){e.$emit("online"),e.isOnline=!0,e.isOffline=!1},t=function(){e.$emit("offline"),e.isOffline=!0,e.isOnline=!1};window.addEventListener("online",n),window.addEventListener("offline",t),this.$once("hook:beforeDestroy",function(){window.removeEventListener("online",n),window.removeEventListener("offline",t)})}}};var r={keys:void 0!==("undefined"==typeof window?"undefined":o(window))?localStorage.getItem("VueOfflineStorageKeys"):null,set:function(e,n){void 0!==("undefined"==typeof window?"undefined":o(window))&&(localStorage.setItem(e,n),function(e){var n=JSON.parse(localStorage.getItem("VueOfflineStorageKeys"))||[];n.push(e),localStorage.setItem("VueOfflineStorageKeys",JSON.stringify(n))}(e))},get:function(e){void 0!==("undefined"==typeof window?"undefined":o(window))&&JSON.parse(localStorage.getItem(e))}},f={install:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{mixin:!0,storage:!0},t=n.mixin;n.storage&&(e.prototype.$offlineStorage=r),t&&e.mixin(i)}};n.default=f}])});
//# sourceMappingURL=vue-offline.min.js.map
{
"name": "vue-offline",
"version": "2.0.1",
"version": "2.0.2",
"description": "Offline states and storage for Vue.js apps and Progressive Web Apps",

@@ -5,0 +5,0 @@ "main": "lib/vue-offline.js",

@@ -7,7 +7,9 @@ # Vue Offline

- [Installation](https://github.com/filrak/vue-offline#installation)
- [Capabilities](https://github.com/filrak/vue-offline#capabilities)
- [VueOfflineMixin](https://github.com/filrak/vue-offline#vueofflinemixin)
- [VueOfflineStorage](https://github.com/filrak/vue-offline#vueofflinestorage)
- [Installation](#installation)
- [Capabilities](#capabilities)
- [VueOfflineMixin](#vueofflinemixin)
- [VueOfflineStorage](#vueofflinestorage)
Initially made for [Vue Storefront](https://github.com/DivanteLtd/vue-storefront)
## Installation

@@ -148,2 +150,2 @@ To install this package as a plugin just type:

}
````
````

@@ -36,2 +36,5 @@ /* global __dirname, require, module*/

loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
},
exclude: /(node_modules|bower_components)/

@@ -38,0 +41,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc