@johnnywang/vue-localstore
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -21,10 +21,2 @@ (function (global, factory) { | ||
var registerInstance = function registerInstance(vm, callVal) { | ||
var i = vm.$options._parentVnode; | ||
if (isDef(i) && isDef(i = i.data)) { | ||
i(vm, callVal); | ||
} | ||
}; | ||
Vue.mixin({ | ||
@@ -40,7 +32,2 @@ beforeCreate: function beforeCreate() { | ||
} | ||
registerInstance(this, this); | ||
}, | ||
destroyed: function destroyed() { | ||
registerInstance(this); | ||
} | ||
@@ -207,3 +194,3 @@ }); | ||
VueLocalStore.install = install; | ||
VueLocalStore.version = '0.0.4'; | ||
VueLocalStore.version = '0.0.5'; | ||
@@ -210,0 +197,0 @@ if (inBrowser && window.Vue) { |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VueLocalStore=e()}(this,(function(){"use strict";var t;var e="undefined"!=typeof window,o=e?window.localStorage:Object.create(null),n="version_name",i="event_data",a="anonymous";function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.app=null,this.options=e,e.prefix=e.prefix||"",e.uid=e.uid||a,e.versionNameKey=e.versionNameKey||n,e.eventDataKey=e.eventDataKey||i,t.observable(this)}return function(t){t.prototype.init=function(t){var e=this;if(t.$once("hook:destroyed",(function(){e.app===t&&(e.app=null)})),!this.app){this.app=t;!function(){var t={},n=e.options.versionName,i=e.options,a=i.versionNameKey,s=i.eventDataKey;if(e.app.$set(e,"__data__",t),n===o[a])try{e.app.$set(t,s,JSON.parse(o[s]))}catch(o){console.warn('[vue-local-store] "event_data" was not defined, use fallback empty object'),e.app.$set(t,s,Object.create(null))}e.setRoot(a,n),e.refreshEventData()}()}},t.prototype.setUid=function(t){t&&(this.options.uid=t)}}(s),function(t){t.prototype.setRoot=function(t,e){var n=this.options.versionNameKey;if(t===n&&this.__version_name_locked__)console.warn('[vue-local-store] key "version_name" cannot be modified');else{if("string"==typeof e)o[t]=e;else try{o[t]=JSON.stringify(e)}catch(e){return void console.warn('[vue-local-store] root key "'.concat(t,'" failed to set'))}this.app.$set(this.__data__,t,e),t===n&&Object.defineProperty(this,"__version_name_locked__",{get:function(){return!0}})}},t.prototype.getRoot=function(t){return this.__data__[t]},t.prototype.removeRoot=function(t){this.app.$set(this.__data__,t,null),delete o[t],delete this.__data__[t]}}(s),function(t){t.prototype.set=function(t,e){var o=this.options.eventDataKey,n=this.getPrefixedKey(t);this.app.$set(this.__data__[o],n,e),this.refreshEventData()},t.prototype.get=function(t){var e=this.options.eventDataKey,o=this.getPrefixedKey(t);return this.__data__[e][o]},t.prototype.remove=function(t){var e=this.options.eventDataKey,o=this.getPrefixedKey(t);this.app.$set(this.__data__[e],o,null),delete this.__data__[e][o],this.refreshEventData()},t.prototype.refreshEventData=function(){var t=this.options.eventDataKey;this.setRoot(t,this.__data__[t]||Object.create(null))},t.prototype.getPrefixedKey=function(t){var e=this.options,o=e.uid,n=e.prefix;return"".concat(n).concat(o,"_").concat(t)}}(s),s.install=function e(o){if(!e.installed||t!==o){e.installed=!0,t=o;var n=function(t){return void 0!==t},i=function(t,e){var o=t.$options._parentVnode;n(o)&&n(o=o.data)&&o(t,e)};o.mixin({beforeCreate:function(){n(this.$options.localStore)?(this._localStoreRoot=this,this._localStore=this.$options.localStore,this._localStore.init(this)):this._localStoreRoot=this.$parent&&this.$parent._localStoreRoot||this,i(this,this)},destroyed:function(){i(this)}}),Object.defineProperty(o.prototype,"$localStore",{get:function(){return this._localStoreRoot._localStore}})}},s.version="0.0.4",e&&window.Vue&&window.Vue.use(s),s})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).VueLocalStore=e()}(this,(function(){"use strict";var t;var e="undefined"!=typeof window,o=e?window.localStorage:Object.create(null),i="version_name",n="event_data",a="anonymous";function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.app=null,this.options=e,e.prefix=e.prefix||"",e.uid=e.uid||a,e.versionNameKey=e.versionNameKey||i,e.eventDataKey=e.eventDataKey||n,t.observable(this)}return function(t){t.prototype.init=function(t){var e=this;if(t.$once("hook:destroyed",(function(){e.app===t&&(e.app=null)})),!this.app){this.app=t;!function(){var t={},i=e.options.versionName,n=e.options,a=n.versionNameKey,s=n.eventDataKey;if(e.app.$set(e,"__data__",t),i===o[a])try{e.app.$set(t,s,JSON.parse(o[s]))}catch(o){console.warn('[vue-local-store] "event_data" was not defined, use fallback empty object'),e.app.$set(t,s,Object.create(null))}e.setRoot(a,i),e.refreshEventData()}()}},t.prototype.setUid=function(t){t&&(this.options.uid=t)}}(s),function(t){t.prototype.setRoot=function(t,e){var i=this.options.versionNameKey;if(t===i&&this.__version_name_locked__)console.warn('[vue-local-store] key "version_name" cannot be modified');else{if("string"==typeof e)o[t]=e;else try{o[t]=JSON.stringify(e)}catch(e){return void console.warn('[vue-local-store] root key "'.concat(t,'" failed to set'))}this.app.$set(this.__data__,t,e),t===i&&Object.defineProperty(this,"__version_name_locked__",{get:function(){return!0}})}},t.prototype.getRoot=function(t){return this.__data__[t]},t.prototype.removeRoot=function(t){this.app.$set(this.__data__,t,null),delete o[t],delete this.__data__[t]}}(s),function(t){t.prototype.set=function(t,e){var o=this.options.eventDataKey,i=this.getPrefixedKey(t);this.app.$set(this.__data__[o],i,e),this.refreshEventData()},t.prototype.get=function(t){var e=this.options.eventDataKey,o=this.getPrefixedKey(t);return this.__data__[e][o]},t.prototype.remove=function(t){var e=this.options.eventDataKey,o=this.getPrefixedKey(t);this.app.$set(this.__data__[e],o,null),delete this.__data__[e][o],this.refreshEventData()},t.prototype.refreshEventData=function(){var t=this.options.eventDataKey;this.setRoot(t,this.__data__[t]||Object.create(null))},t.prototype.getPrefixedKey=function(t){var e=this.options,o=e.uid,i=e.prefix;return"".concat(i).concat(o,"_").concat(t)}}(s),s.install=function e(o){if(!e.installed||t!==o){e.installed=!0,t=o;o.mixin({beforeCreate:function(){void 0!==this.$options.localStore?(this._localStoreRoot=this,this._localStore=this.$options.localStore,this._localStore.init(this)):this._localStoreRoot=this.$parent&&this.$parent._localStoreRoot||this}}),Object.defineProperty(o.prototype,"$localStore",{get:function(){return this._localStoreRoot._localStore}})}},s.version="0.0.5",e&&window.Vue&&window.Vue.use(s),s})); |
{ | ||
"name": "@johnnywang/vue-localstore", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A tiny plugin for vue localstorage with version control & prefixed keys", | ||
@@ -5,0 +5,0 @@ "author": "johnnywang", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14526
162