![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
org.webjars.npm:github-com-cmp-cc-vue-cookies
Advanced tools
A simple Vue.js plugin for handling browser cookies
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-cookies@1.5.12/vue-cookies.js"></script>
npm install vue-cookies --save
// require
var Vue = require('vue')
Vue.use(require('vue-cookies'))
// es2015 module
import Vue from 'vue'
import VueCookies from 'vue-cookies'
Vue.use(VueCookies)
// set default config
VueCookies.config('7d')
// set global cookie
VueCookies.set('theme','default');
VueCookies.set('hover-time','1s');
syntax format: [this | Vue | window].$cookies.[method]
$cookies.config(expireTimes[,path]) // default: expireTimes = 1d , path=/
$cookies.set(keyName, value[, expireTimes[, path[, domain[, secure]]]]) //return this
$cookies.get(keyName) // return value
$cookies.remove(keyName [, path [, domain]]) // return this
cookie name
$cookies.isKey(keyName) // return false or true
cookie name
this.$cookies.keys() // return a array
// 30 day after, expire
this.$cookies.config('30d')
this.$cookies.config(new Date(2019,03,13).toUTCString())
// 30 day after, expire, '' current path , browser default
this.$cookies.config(60 * 60 * 24 * 30,'');
// window object
window.$cookies.config('30d')
var user = { id:1, name:'Journal',session:'25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX' };
this.$cookies.set('user',user);
// print user name
console.log(this.$cookies.get('user').name)
Suppose the current time is : Sat, 11 Mar 2017 12:25:57 GMT
Following equivalence: 1 day after, expire
Support chaining sets together
// default expire time: 1 day
this.$cookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX")
// number + d , ignore case
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX","1d")
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX","1D")
// Base of second
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX",60 * 60 * 24)
// input a Date, + 1day
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX", new Date(2017, 03, 12))
// input a date string, + 1day
.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX", "Sat, 13 Mar 2017 12:25:57 GMT")
this.$cookies.set("default_unit_second","input_value",1); // 1 second after, expire
this.$cookies.set("default_unit_second","input_value",60 + 30); // 1 minute 30 second after, expire
this.$cookies.set("default_unit_second","input_value",60 * 60 * 12); // 12 hour after, expire
this.$cookies.set("default_unit_second","input_value",60 * 60 * 24 * 30); // 1 month after, expire
this.$cookies.set("default_unit_second","input_value","0"); // end of session - use string!
Unit | full name |
---|---|
y | year |
m | month |
d | day |
h | hour |
min | minute |
s | second |
Unit Names Ignore Case
not support the combination
not support the double value
this.$cookies.set("token","GH1.1.1689020474.1484362313","60s"); // 60 second after, expire
this.$cookies.set("token","GH1.1.1689020474.1484362313","30MIN"); // 30 minute after, expire, ignore case
this.$cookies.set("token","GH1.1.1689020474.1484362313","24d"); // 24 day after, expire
this.$cookies.set("token","GH1.1.1689020474.1484362313","4m"); // 4 month after, expire
this.$cookies.set("token","GH1.1.1689020474.1484362313","16h"); // 16 hour after, expire
this.$cookies.set("token","GH1.1.1689020474.1484362313","3y"); // 3 year after, expire
// input date string
this.$cookies.set('token',"GH1.1.1689020474.1484362313", new Date(2017,03,13).toUTCString());
this.$cookies.set("token","GH1.1.1689020474.1484362313", "Sat, 13 Mar 2017 12:25:57 GMT ");
var date = new Date;
date.setDate(date.getDate() + 1);
this.$cookies.set("token","GH1.1.1689020474.1484362313", date);
this.$cookies.set("token","GH1.1.1689020474.1484362313", Infinity); // never expire
// never expire , only -1,Other negative Numbers are invalid
this.$cookies.set("token","GH1.1.1689020474.1484362313", -1);
// set path
this.$cookies.set("use_path_argument","value","1d","/app");
// set domain
this.$cookies.set("use_path_argument","value",null, null, "domain.com"); // default 1 day after,expire
// set secure
this.$cookies.set("use_path_argument","value",null, null, null,true);
// check a cookie exist
this.$cookies.isKey("token")
// get a cookie
this.$cookies.get("token");
// remove a cookie
this.$cookies.remove("token");
// get all cookie key names, line shows
this.$cookies.keys().join("\n");
// vue-cookies global
[this | Vue | window].$cookies.[method]
$cookies key names Cannot be set to ['expires','max-age','path','domain','secure']
vue-cookies no dependencies, It can exist independently, Friendly to vuejs
window.$cookies.get
window.$cookies.set
window.$cookies.isKey
window.$cookies.remove
window.$cookies.keys
MIT Copyright (c) 2016-present, cmp-cc
FAQs
WebJar for vue-cookies
We found that org.webjars.npm:github-com-cmp-cc-vue-cookies demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.