
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@johnnywang/vue-localstore
Advanced tools
A tiny plugin for vue localstorage with version control & prefixed keys
vue localStorage plugin with prefix
, unique id
injectable for vue2.x which can control version by version_name
feature.
VueLocalStore is an umd module, you can easily use by cdn or es6 module
$ npm install @johnnywang/vue-localstore
Same as vue-router, create localStore instance
// localStore.js
import Vue from 'vue';
import VueLocalStore from '@johnnywang/vue-localstore';
Vue.use(VueLocalStore);
const localStore = new VueLocalStore({
versionName: 'test_v0.0.1',
versionNameKey: 'version_name', // default
eventDataKey: 'event_data', // default
prefix: '', // default
uid: 'anonymous', // default: can be changed later by `setUid`
});
export default localStore;
// main.js
import Vue from 'vue';
import localStore from './localStore';
new Vue({
localStore,
}).$mount('#app');
// App.vue
export default {
mounted() {
console.log(this.$localStore);
},
};
set prefixed uid content, uid
will be concat as bellow:
string
anonymous
const prefixedKey = `${prefix}${uid}_${key}`;
export default {
created() {
this.$localStore.setUid('good_uid_30678444');
},
};
set localstorage to root key(real localstorage)
string
any
export default {
created() {
this.$localStore.setRoot('name', 'Johnny');
},
};
get localStorage root key's value
string
export default {
created() {
this.$localStore.getRoot('name');
},
};
remove localStorage root key
string
export default {
created() {
this.$localStore.removeRoot('name');
},
};
set event data key with value, the key will be prefixed.
string
any
export default {
created() {
this.$localStore.set('name', 'Johnny');
},
};
get event data key's value, the key will be prefixed.
string
export default {
created() {
this.$localStore.set('name', 'Johnny');
},
};
remove event data key, the key will be prefixed.
string
export default {
created() {
this.$localStore.remove('name');
},
};
version_name for this content
localStorage key name for storing version_name
localStorage key name for storing event_data
prefix value for event_data object's property
inject uid to seperate user or other usage, can be modified later by setUid
api.
FAQs
A tiny plugin for vue localstorage with version control & prefixed keys
We found that @johnnywang/vue-localstore demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.