Comparing version 3.1.0 to 3.2.0
@@ -7,11 +7,30 @@ (function (global, factory) { | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
/* eslint class-methods-use-this: off */ | ||
var ls = {}; | ||
var MemoryStorageInterface = function () { | ||
var MemoryStorageInterface = | ||
/*#__PURE__*/ | ||
function () { | ||
function MemoryStorageInterface() { | ||
@@ -31,3 +50,2 @@ _classCallCheck(this, MemoryStorageInterface); | ||
} | ||
/** | ||
@@ -42,7 +60,6 @@ * Get item | ||
_createClass(MemoryStorageInterface, [{ | ||
key: 'getItem', | ||
key: "getItem", | ||
value: function getItem(name) { | ||
return name in ls ? ls[name] : null; | ||
} | ||
/** | ||
@@ -57,9 +74,7 @@ * Set item | ||
}, { | ||
key: 'setItem', | ||
key: "setItem", | ||
value: function setItem(name, value) { | ||
ls[name] = value; | ||
return true; | ||
} | ||
/** | ||
@@ -73,3 +88,3 @@ * Remove item | ||
}, { | ||
key: 'removeItem', | ||
key: "removeItem", | ||
value: function removeItem(name) { | ||
@@ -84,3 +99,2 @@ var found = name in ls; | ||
} | ||
/** | ||
@@ -93,9 +107,7 @@ * Clear storage | ||
}, { | ||
key: 'clear', | ||
key: "clear", | ||
value: function clear() { | ||
ls = {}; | ||
return true; | ||
} | ||
/** | ||
@@ -109,6 +121,5 @@ * Get item by key | ||
}, { | ||
key: 'key', | ||
key: "key", | ||
value: function key(index) { | ||
var keys = Object.keys(ls); | ||
return typeof keys[index] !== 'undefined' ? keys[index] : null; | ||
@@ -123,17 +134,98 @@ } | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var listeners = {}; | ||
/** | ||
* Event class | ||
*/ | ||
var _createClass$1 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var WebStorageEvent = | ||
/*#__PURE__*/ | ||
function () { | ||
function WebStorageEvent() { | ||
_classCallCheck(this, WebStorageEvent); | ||
} | ||
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
_createClass(WebStorageEvent, null, [{ | ||
key: "on", | ||
/** | ||
* Add storage change event | ||
* | ||
* @param {string} name | ||
* @param {Function} callback | ||
*/ | ||
value: function on(name, callback) { | ||
if (typeof listeners[name] === 'undefined') { | ||
listeners[name] = []; | ||
} | ||
listeners[name].push(callback); | ||
} | ||
/** | ||
* Remove storage change event | ||
* | ||
* @param {string} name | ||
* @param {Function} callback | ||
*/ | ||
}, { | ||
key: "off", | ||
value: function off(name, callback) { | ||
if (listeners[name].length) { | ||
listeners[name].splice(listeners[name].indexOf(callback), 1); | ||
} else { | ||
listeners[name] = []; | ||
} | ||
} | ||
/** | ||
* Emit event | ||
* | ||
* @param {Object} event | ||
*/ | ||
}, { | ||
key: "emit", | ||
value: function emit(event) { | ||
var e = event || window.event; | ||
var getValue = function getValue(data) { | ||
try { | ||
return JSON.parse(data).value; | ||
} catch (err) { | ||
return data; | ||
} | ||
}; | ||
var fire = function fire(listener) { | ||
var newValue = getValue(e.newValue); | ||
var oldValue = getValue(e.oldValue); | ||
listener(newValue, oldValue, e.url || e.uri); | ||
}; | ||
if (typeof e === 'undefined' || typeof e.key === 'undefined') { | ||
return; | ||
} | ||
var all = listeners[e.key]; | ||
if (typeof all !== 'undefined') { | ||
all.forEach(fire); | ||
} | ||
} | ||
}]); | ||
return WebStorageEvent; | ||
}(); | ||
/** | ||
* Storage Bridge | ||
*/ | ||
var WebStorage$$1 = function () { | ||
var WebStorage = | ||
/*#__PURE__*/ | ||
function () { | ||
/** | ||
* @param {Object} storage | ||
*/ | ||
function WebStorage$$1(storage) { | ||
_classCallCheck$1(this, WebStorage$$1); | ||
function WebStorage(storage) { | ||
_classCallCheck(this, WebStorage); | ||
@@ -145,3 +237,2 @@ this.storage = storage; | ||
}; | ||
Object.defineProperty(this, 'length', { | ||
@@ -163,5 +254,5 @@ /** | ||
} else if (window.attachEvent) { | ||
window.attachEvent('on' + this.options.events[i], WebStorageEvent.emit); | ||
window.attachEvent("on".concat(this.options.events[i]), WebStorageEvent.emit); | ||
} else { | ||
window['on' + this.options.events[i]] = WebStorageEvent.emit; | ||
window["on".concat(this.options.events[i])] = WebStorageEvent.emit; | ||
} | ||
@@ -171,3 +262,2 @@ } | ||
} | ||
/** | ||
@@ -180,10 +270,8 @@ * Set Options | ||
_createClass$1(WebStorage$$1, [{ | ||
key: 'setOptions', | ||
_createClass(WebStorage, [{ | ||
key: "setOptions", | ||
value: function setOptions() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
this.options = _extends(this.options, options); | ||
this.options = Object.assign(this.options, options); | ||
} | ||
/** | ||
@@ -198,6 +286,5 @@ * Set item | ||
}, { | ||
key: 'set', | ||
key: "set", | ||
value: function set(name, value) { | ||
var expire = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
var stringifyValue = JSON.stringify({ | ||
@@ -207,6 +294,4 @@ value: value, | ||
}); | ||
this.storage.setItem(this.options.namespace + name, stringifyValue); | ||
} | ||
/** | ||
@@ -221,6 +306,5 @@ * Get item | ||
}, { | ||
key: 'get', | ||
key: "get", | ||
value: function get(name) { | ||
var def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
var item = this.storage.getItem(this.options.namespace + name); | ||
@@ -248,3 +332,2 @@ | ||
} | ||
/** | ||
@@ -258,7 +341,6 @@ * Get item by key | ||
}, { | ||
key: 'key', | ||
key: "key", | ||
value: function key(index) { | ||
return this.storage.key(index); | ||
} | ||
/** | ||
@@ -272,7 +354,6 @@ * Remove item | ||
}, { | ||
key: 'remove', | ||
key: "remove", | ||
value: function remove(name) { | ||
return this.storage.removeItem(this.options.namespace + name); | ||
} | ||
/** | ||
@@ -283,3 +364,3 @@ * Clear storage | ||
}, { | ||
key: 'clear', | ||
key: "clear", | ||
value: function clear() { | ||
@@ -294,3 +375,3 @@ if (this.length === 0) { | ||
var key = this.storage.key(i); | ||
var regexp = new RegExp('^' + this.options.namespace + '.+', 'i'); | ||
var regexp = new RegExp("^".concat(this.options.namespace, ".+"), 'i'); | ||
@@ -308,3 +389,2 @@ if (regexp.test(key) === false) { | ||
} | ||
/** | ||
@@ -318,7 +398,6 @@ * Add storage change event | ||
}, { | ||
key: 'on', | ||
key: "on", | ||
value: function on(name, callback) { | ||
WebStorageEvent.on(this.options.namespace + name, callback); | ||
} | ||
/** | ||
@@ -332,3 +411,3 @@ * Remove storage change event | ||
}, { | ||
key: 'off', | ||
key: "off", | ||
value: function off(name, callback) { | ||
@@ -339,102 +418,11 @@ WebStorageEvent.off(this.options.namespace + name, callback); | ||
return WebStorage$$1; | ||
return WebStorage; | ||
}(); | ||
var _createClass$2 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var listeners = {}; | ||
var _global = typeof window !== 'undefined' ? window : global || {}; | ||
/** | ||
* Event class | ||
* @type {{install: (function(Object, Object): WebStorage)}} | ||
*/ | ||
var WebStorageEvent = function () { | ||
function WebStorageEvent() { | ||
_classCallCheck$2(this, WebStorageEvent); | ||
} | ||
_createClass$2(WebStorageEvent, null, [{ | ||
key: 'on', | ||
/** | ||
* Add storage change event | ||
* | ||
* @param {string} name | ||
* @param {Function} callback | ||
*/ | ||
value: function on(name, callback) { | ||
if (typeof listeners[name] === 'undefined') { | ||
listeners[name] = []; | ||
} | ||
listeners[name].push(callback); | ||
} | ||
/** | ||
* Remove storage change event | ||
* | ||
* @param {string} name | ||
* @param {Function} callback | ||
*/ | ||
}, { | ||
key: 'off', | ||
value: function off(name, callback) { | ||
if (listeners[name].length) { | ||
listeners[name].splice(listeners[name].indexOf(callback), 1); | ||
} else { | ||
listeners[name] = []; | ||
} | ||
} | ||
/** | ||
* Emit event | ||
* | ||
* @param {Object} event | ||
*/ | ||
}, { | ||
key: 'emit', | ||
value: function emit(event) { | ||
var e = event || window.event; | ||
var getValue = function getValue(data) { | ||
try { | ||
return JSON.parse(data).value; | ||
} catch (err) { | ||
return data; | ||
} | ||
}; | ||
var fire = function fire(listener) { | ||
var newValue = getValue(e.newValue); | ||
var oldValue = getValue(e.oldValue); | ||
listener(newValue, oldValue, e.url || e.uri); | ||
}; | ||
if (typeof e === 'undefined' || typeof e.key === 'undefined') { | ||
return; | ||
} | ||
var all = listeners[e.key]; | ||
if (typeof all !== 'undefined') { | ||
all.forEach(fire); | ||
} | ||
} | ||
}]); | ||
return WebStorageEvent; | ||
}(); | ||
var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
// eslint-disable-next-line | ||
var _global = typeof window !== 'undefined' ? window : global || {}; | ||
/** | ||
* @type {{install: (function(Object, Object): WebStorage)}} | ||
*/ | ||
var VueStorage = { | ||
@@ -451,3 +439,3 @@ /** | ||
var _options = _extends$1({}, options, { | ||
var _options = Object.assign({}, options, { | ||
storage: options.storage || 'local', | ||
@@ -458,3 +446,3 @@ name: options.name || 'ls' | ||
if (_options.storage && ['memory', 'local', 'session'].indexOf(_options.storage) === -1) { | ||
throw new Error('Vue-ls: Storage "' + _options.storage + '" is not supported'); | ||
throw new Error("Vue-ls: Storage \"".concat(_options.storage, "\" is not supported")); | ||
} | ||
@@ -464,3 +452,4 @@ | ||
switch (_options.storage) {// eslint-disable-line | ||
switch (_options.storage) { | ||
// eslint-disable-line | ||
case 'local': | ||
@@ -473,2 +462,3 @@ store = 'localStorage' in _global ? _global.localStorage : null; | ||
break; | ||
case 'memory': | ||
@@ -480,15 +470,14 @@ store = MemoryStorage; | ||
if (!store) { | ||
store = MemoryStorage; | ||
// eslint-disable-next-line | ||
console.error('Vue-ls: Storage "' + _options.storage + '" is not supported your system, use memory storage'); | ||
store = MemoryStorage; // eslint-disable-next-line | ||
console.error("Vue-ls: Storage \"".concat(_options.storage, "\" is not supported your system, use memory storage")); | ||
} | ||
var ls = new WebStorage$$1(store); | ||
ls.setOptions(_extends$1(ls.options, { | ||
var ls = new WebStorage(store); | ||
ls.setOptions(Object.assign(ls.options, { | ||
namespace: '' | ||
}, _options || {})); | ||
Vue[_options.name] = ls; // eslint-disable-line | ||
Vue[_options.name] = ls; // eslint-disable-line | ||
Object.defineProperty(Vue.prototype, '$' + _options.name, { | ||
Object.defineProperty(Vue.prototype, "$".concat(_options.name), { | ||
/** | ||
@@ -505,3 +494,2 @@ * Define $ls property | ||
}; | ||
_global.VueStorage = VueStorage; | ||
@@ -508,0 +496,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.VueStorage=n()}(this,function(){"use strict";var n=function(){function o(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,n,t){return n&&o(e.prototype,n),t&&o(e,t),e}}();var t={},i=new(function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,"length",{get:function(){return Object.keys(t).length}})}return n(e,[{key:"getItem",value:function(e){return e in t?t[e]:null}},{key:"setItem",value:function(e,n){return t[e]=n,!0}},{key:"removeItem",value:function(e){return!!(e in t)&&delete t[e]}},{key:"clear",value:function(){return t={},!0}},{key:"key",value:function(e){var n=Object.keys(t);return void 0!==n[e]?n[e]:null}}]),e}()),o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},e=function(){function o(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,n,t){return n&&o(e.prototype,n),t&&o(e,t),e}}();var a=function(){function t(e){if(function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.storage=e,this.options={namespace:"",events:["storage"]},Object.defineProperty(this,"length",{get:function(){return this.storage.length}}),"undefined"!=typeof window)for(var n in this.options.events)window.addEventListener?window.addEventListener(this.options.events[n],u.emit,!1):window.attachEvent?window.attachEvent("on"+this.options.events[n],u.emit):window["on"+this.options.events[n]]=u.emit}return e(t,[{key:"setOptions",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.options=o(this.options,e)}},{key:"set",value:function(e,n){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,o=JSON.stringify({value:n,expire:null!==t?(new Date).getTime()+t:null});this.storage.setItem(this.options.namespace+e,o)}},{key:"get",value:function(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,t=this.storage.getItem(this.options.namespace+e);if(null!==t)try{var o=JSON.parse(t);if(null===o.expire)return o.value;if(o.expire>=(new Date).getTime())return o.value;this.remove(e)}catch(e){return n}return n}},{key:"key",value:function(e){return this.storage.key(e)}},{key:"remove",value:function(e){return this.storage.removeItem(this.options.namespace+e)}},{key:"clear",value:function(){if(0!==this.length){for(var e=[],n=0;n<this.length;n++){var t=this.storage.key(n);!1!==new RegExp("^"+this.options.namespace+".+","i").test(t)&&e.push(t)}for(var o in e)this.storage.removeItem(e[o])}}},{key:"on",value:function(e,n){u.on(this.options.namespace+e,n)}},{key:"off",value:function(e,n){u.off(this.options.namespace+e,n)}}]),t}(),r=function(){function o(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,n,t){return n&&o(e.prototype,n),t&&o(e,t),e}}();var s={},u=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"on",value:function(e,n){void 0===s[e]&&(s[e]=[]),s[e].push(n)}},{key:"off",value:function(e,n){s[e].length?s[e].splice(s[e].indexOf(n),1):s[e]=[]}},{key:"emit",value:function(e){var n=e||window.event,t=function(n){try{return JSON.parse(n).value}catch(e){return n}};if(void 0!==n&&void 0!==n.key){var o=s[n.key];void 0!==o&&o.forEach(function(e){e(t(n.newValue),t(n.oldValue),n.url||n.uri)})}}}]),e}(),l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},c="undefined"!=typeof window?window:global||{},f={install:function(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},t=l({},n,{storage:n.storage||"local",name:n.name||"ls"});if(t.storage&&-1===["memory","local","session"].indexOf(t.storage))throw new Error('Vue-ls: Storage "'+t.storage+'" is not supported');var o=null;switch(t.storage){case"local":o="localStorage"in c?c.localStorage:null;break;case"session":o="sessionStorage"in c?c.sessionStorage:null;break;case"memory":o=i}o||(o=i,console.error('Vue-ls: Storage "'+t.storage+'" is not supported your system, use memory storage'));var r=new a(o);r.setOptions(l(r.options,{namespace:""},t||{})),e[t.name]=r,Object.defineProperty(e.prototype,"$"+t.name,{get:function(){return r}})}};return c.VueStorage=f}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.VueStorage=t()}(this,function(){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function t(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}var n={},r=new(function(){function e(){o(this,e),Object.defineProperty(this,"length",{get:function(){return Object.keys(n).length}})}return t(e,[{key:"getItem",value:function(e){return e in n?n[e]:null}},{key:"setItem",value:function(e,t){return n[e]=t,!0}},{key:"removeItem",value:function(e){return!!(e in n)&&delete n[e]}},{key:"clear",value:function(){return n={},!0}},{key:"key",value:function(e){var t=Object.keys(n);return void 0!==t[e]?t[e]:null}}]),e}()),s={},a=function(){function e(){o(this,e)}return t(e,null,[{key:"on",value:function(e,t){void 0===s[e]&&(s[e]=[]),s[e].push(t)}},{key:"off",value:function(e,t){s[e].length?s[e].splice(s[e].indexOf(t),1):s[e]=[]}},{key:"emit",value:function(e){var t=e||window.event,n=function(t){try{return JSON.parse(t).value}catch(e){return t}};if(void 0!==t&&void 0!==t.key){var o=s[t.key];void 0!==o&&o.forEach(function(e){e(n(t.newValue),n(t.oldValue),t.url||t.uri)})}}}]),e}(),u=function(){function n(e){if(o(this,n),this.storage=e,this.options={namespace:"",events:["storage"]},Object.defineProperty(this,"length",{get:function(){return this.storage.length}}),"undefined"!=typeof window)for(var t in this.options.events)window.addEventListener?window.addEventListener(this.options.events[t],a.emit,!1):window.attachEvent?window.attachEvent("on".concat(this.options.events[t]),a.emit):window["on".concat(this.options.events[t])]=a.emit}return t(n,[{key:"setOptions",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.options=Object.assign(this.options,e)}},{key:"set",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,o=JSON.stringify({value:t,expire:null!==n?(new Date).getTime()+n:null});this.storage.setItem(this.options.namespace+e,o)}},{key:"get",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,n=this.storage.getItem(this.options.namespace+e);if(null!==n)try{var o=JSON.parse(n);if(null===o.expire)return o.value;if(o.expire>=(new Date).getTime())return o.value;this.remove(e)}catch(e){return t}return t}},{key:"key",value:function(e){return this.storage.key(e)}},{key:"remove",value:function(e){return this.storage.removeItem(this.options.namespace+e)}},{key:"clear",value:function(){if(0!==this.length){for(var e=[],t=0;t<this.length;t++){var n=this.storage.key(t);!1!==new RegExp("^".concat(this.options.namespace,".+"),"i").test(n)&&e.push(n)}for(var o in e)this.storage.removeItem(e[o])}}},{key:"on",value:function(e,t){a.on(this.options.namespace+e,t)}},{key:"off",value:function(e,t){a.off(this.options.namespace+e,t)}}]),n}(),l="undefined"!=typeof window?window:global||{},e={install:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=Object.assign({},t,{storage:t.storage||"local",name:t.name||"ls"});if(n.storage&&-1===["memory","local","session"].indexOf(n.storage))throw new Error('Vue-ls: Storage "'.concat(n.storage,'" is not supported'));var o=null;switch(n.storage){case"local":o="localStorage"in l?l.localStorage:null;break;case"session":o="sessionStorage"in l?l.sessionStorage:null;break;case"memory":o=r}o||(o=r,console.error('Vue-ls: Storage "'.concat(n.storage,'" is not supported your system, use memory storage')));var i=new u(o);i.setOptions(Object.assign(i.options,{namespace:""},n||{})),e[n.name]=i,Object.defineProperty(e.prototype,"$".concat(n.name),{get:function(){return i}})}};return l.VueStorage=e}); |
{ | ||
"name": "vue-ls", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Vue plugin for work with LocalStorage from Vue context", | ||
@@ -13,3 +13,3 @@ "main": "dist/vue-ls.js", | ||
"scripts": { | ||
"build": "node_modules/.bin/rollup -c ./build/rollup.config.js && NODE_ENV=production node_modules/.bin/rollup -c ./build/rollup.config.js", | ||
"build": "node_modules/.bin/rollup -c ./build/rollup.config.js --name VueStorage && NODE_ENV=production node_modules/.bin/rollup -c ./build/rollup.config.js --name VueStorage", | ||
"test": "NODE_ENV=test node_modules/.bin/nyc node_modules/.bin/ava", | ||
@@ -72,21 +72,21 @@ "test:browserstack": "RUN_ON_BSTACK=true BSTACK_LOCAL=true node_modules/.bin/gulp test --env bstack_chrome_50,bstack_chrome_57,bstack_ie_9,bstack_ie_11,bstack_edge_13,bstack_edge_14,bstack_firefox_40,bstack_firefox_52,bstack_safari_8,bstack_safari_10", | ||
"devDependencies": { | ||
"ava": "^0.25.0", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^8.2.3", | ||
"babel-loader": "^7.1.4", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", | ||
"babel-plugin-transform-object-assign": "^6.22.0", | ||
"babel-polyfill": "^6.26.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-register": "^6.26.0", | ||
"@babel/core": "^7.0.0", | ||
"@babel/plugin-syntax-dynamic-import": "^7.0.0", | ||
"@babel/plugin-transform-modules-commonjs": "^7.0.0", | ||
"@babel/plugin-transform-runtime": "^7.0.0", | ||
"@babel/polyfill": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"@babel/register": "^7.0.0", | ||
"@babel/runtime": "^7.0.0", | ||
"ava": "^1.0.0-beta.8", | ||
"babel-eslint": "^9.0.0", | ||
"babel-loader": "^8.0.2", | ||
"browserstack-automate": "^1.0.2", | ||
"chromedriver": "^2.40.0", | ||
"chromedriver": "^2.41.0", | ||
"connect": "^3.6.6", | ||
"coveralls": "^3.0.0", | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-plugin-import": "^2.12.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-promise": "^3.8.0", | ||
"eslint-plugin-standard": "^3.1.0", | ||
"coveralls": "^3.0.2", | ||
"eslint": "^5.5.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-node": "^7.0.0", | ||
"get-gulp-args": "^0.0.1", | ||
@@ -96,22 +96,22 @@ "gulp": "4.0.0", | ||
"gulp-util": "^3.0.8", | ||
"jasmine": "^3.1.0", | ||
"jasmine-core": "^3.1.0", | ||
"karma": "^2.0.0", | ||
"jasmine": "^3.2.0", | ||
"jasmine-core": "^3.2.1", | ||
"karma": "^3.0.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-jasmine": "^1.1.2", | ||
"karma-sauce-launcher": "^1.2.0", | ||
"karma-webpack": "^3.0.0", | ||
"karma-webpack": "^3.0.2", | ||
"mock-browser": "^0.92.14", | ||
"nightwatch": "^1.0.1", | ||
"nyc": "^12.0.2", | ||
"nyc": "^13.0.1", | ||
"phantomjs": "^2.1.7", | ||
"remove": "^0.1.5", | ||
"rollup": "^0.60.7", | ||
"rollup-plugin-babel": "^3.0.4", | ||
"rollup": "^0.65.2", | ||
"rollup-plugin-babel": "^4.0.3", | ||
"rollup-plugin-local-resolve": "^1.0.7", | ||
"rollup-plugin-uglify": "^4.0.0", | ||
"selenium-server": "^3.12.0", | ||
"rollup-plugin-uglify": "^5.0.0", | ||
"selenium-server": "^3.14.0", | ||
"serve-static": "^1.13.2", | ||
"vue": "^2.5.16", | ||
"webpack": "^4.5.0" | ||
"vue": "^2.5.17", | ||
"webpack": "^4.17.2" | ||
}, | ||
@@ -129,5 +129,4 @@ "semistandard": { | ||
"babel": { | ||
"babelrc": true, | ||
"plugins": [ | ||
"transform-es2015-modules-commonjs" | ||
"extensions": [ | ||
"js" | ||
] | ||
@@ -140,6 +139,6 @@ }, | ||
"require": [ | ||
"babel-register", | ||
"babel-polyfill" | ||
"@babel/register", | ||
"@babel/polyfill" | ||
] | ||
} | ||
} |
@@ -1,9 +0,3 @@ | ||
import { MemoryStorage } from './MemoryStorage'; | ||
import { WebStorage } from './WebStorage'; | ||
import { WebStorageEvent } from './WebStorageEvent'; | ||
export { | ||
MemoryStorage, | ||
WebStorage, | ||
WebStorageEvent, | ||
}; | ||
export * from './MemoryStorage'; | ||
export * from './WebStorage'; | ||
export * from './WebStorageEvent'; |
@@ -1,2 +0,2 @@ | ||
import { WebStorageEvent } from './'; | ||
import { WebStorageEvent } from './WebStorageEvent'; | ||
@@ -3,0 +3,0 @@ /** |
749
36599