Skip to content

Instantly share code, notes, and snippets.

@meeech
Created July 21, 2010 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save meeech/485122 to your computer and use it in GitHub Desktop.
Save meeech/485122 to your computer and use it in GitHub Desktop.
var myCookie;
myCookie = function(config) {
myCookie.superclass.constructor.apply(this,arguments);
};
Y.extend(myCookie, Y.Cookie, {
_createCookieString : function (name /*:String*/, value /*:Variant*/, encodeValue /*:Boolean*/, options /*:Object*/) /*:String*/ {
options = options || {};
console.log(name);
var text /*:String*/ = (encodeValue ? encode(name) : name) + "=" + (encodeValue ? encode(value) : value),
expires = options.expires,
path = options.path,
domain = options.domain;
if (isObject(options)){
//expiration date
if (expires instanceof Date){
text += "; expires=" + expires.toUTCString();
}
//path
if (isString(path) && path !== ""){
text += "; path=" + path;
}
//domain
if (isString(domain) && domain !== ""){
text += "; domain=" + domain;
}
//secure
if (options.secure === true){
text += "; secure";
}
}
return text;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment