
Документация
на русском v1.2.5 Документацитя по MooTools 1.4.5 Обсуждение Установить себе Благодарности
на русском v1.2.5 Документацитя по MooTools 1.4.5 Обсуждение Установить себе Благодарности
Stores and loads a Hash as a Cookie using JSON format.
var myHashCookie = new Hash.Cookie(name[, options]);
var fruits = new Hash.Cookie('myCookieName', {duration: 3600}); fruits.extend({ 'lemon': 'yellow', 'apple': 'red' }); fruits.set('melon', 'green'); fruits.get('lemon'); // yellow // ... on another page ... values load automatically var fruits = new Hash.Cookie('myCookieName', {duration: 365}); fruits.get('melon'); // green fruits.erase(); // delete cookie
Saves the Hash to the cookie. If the hash is empty, removes the cookie.
myHashCookie.save();
var login = new Hash.Cookie('userstatus', {autoSave: false}); login.extend({ 'username': 'John', 'credentials': [4, 7, 9] }); login.set('last_message', 'User logged in!'); login.save(); // finally save the Hash
Loads the cookie and assigns it to the Hash.
myHashCookie.load();
var myHashCookie = new Hash.Cookie('myCookie'); (function(){ myHashCookie.load(); if(!myHashCookie.length) alert('Cookie Monster must of eaten it!'); }).periodical(5000);
© Linux.ria.ua, 2008-2018 |