add generic docstrings
This commit is contained in:
parent
6bc3bf06c9
commit
c6abd72681
@ -17,6 +17,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
|
||||||
|
/* manage cookies */
|
||||||
class Cookie {
|
class Cookie {
|
||||||
|
|
||||||
constructor(cookie_name='', value='', expire_days=365, path='/') {
|
constructor(cookie_name='', value='', expire_days=365, path='/') {
|
||||||
@ -28,8 +29,8 @@ class Cookie {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* save a cookie */
|
||||||
set(name, value, expire_days=365, path='/') {
|
set(name, value, expire_days=365, path='/') {
|
||||||
// save a cookie
|
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
date.setTime(date.getTime() + (expire_days * 24 * 60 * 60 * 1000));
|
date.setTime(date.getTime() + (expire_days * 24 * 60 * 60 * 1000));
|
||||||
@ -38,8 +39,8 @@ class Cookie {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* return a cookie */
|
||||||
get(cookie_name) {
|
get(cookie_name) {
|
||||||
// return a cookie
|
|
||||||
|
|
||||||
let name = cookie_name + '=';
|
let name = cookie_name + '=';
|
||||||
let cookies = document.cookie.split(';');
|
let cookies = document.cookie.split(';');
|
||||||
@ -60,9 +61,8 @@ class Cookie {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* delete a cookie */
|
||||||
delete(name) {
|
delete(name) {
|
||||||
// deleta a cookie
|
|
||||||
|
|
||||||
this.set(name, '', -1)
|
this.set(name, '', -1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user