var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/// <reference path="../base/BaseClass.ts" />
/// <reference path="./ICookieConfigOptions.ts" />
var econda;
(function (econda) {
var cookie;
(function (cookie) {
/**
* Single cookie record. Used to add new cookies to browsers. See {@link econda.cookie.Store#set} for details.
* @class econda.cookie.Cookie
*/
var Cookie = (function (_super) {
__extends(Cookie, _super);
function Cookie(cfg) {
_super.call(this);
/**
* Name of cookie
* @cfg {String} name
* @accessor
*/
this._name = "";
/**
* Cookie value
* @cfg {String} value
* @accessor
*/
this._value = "";
/**
* Cookie domain
* @cfg {String} domain
* @accessor
*/
this._domain = "";
/**
* Restrict cookie to uris containing this path
* @cfg {String} path
* @accessor
*/
this._path = '/';
/**
* Expriation date. Set to null for "session cookies".
* @cfg {Date} expires
* @accessor
*/
this._expires = null;
/**
* Is secure
* @cfg {Boolean} secure
* @accessor
*/
this._secure = false;
if (cfg instanceof Cookie) {
return cfg;
}
this.initConfig(cfg);
}
Cookie.prototype.getName = function () {
return this._name;
};
Cookie.prototype.setName = function (name) {
this._name = name;
return this;
};
Cookie.prototype.getValue = function () {
return this._value;
};
Cookie.prototype.setValue = function (value) {
this._value = value;
return this;
};
Cookie.prototype.getDomain = function () {
return this._domain;
};
Cookie.prototype.setDomain = function (domainName) {
this._domain = domainName;
return this;
};
Cookie.prototype.getPath = function () {
return this._path;
};
Cookie.prototype.setPath = function (path) {
this._path = path;
return this;
};
Cookie.prototype.getExpires = function () {
return this._expires;
};
Cookie.prototype.setExpires = function (dateOrDays) {
var expirationDate;
if (typeof dateOrDays == 'number') {
expirationDate = new Date();
expirationDate.setDate(expirationDate.getDate() + dateOrDays);
}
else {
expirationDate = dateOrDays;
}
this._expires = expirationDate;
return this;
};
Cookie.prototype.getSecure = function () {
return this._secure;
};
Cookie.prototype.setSecure = function (isSecure) {
this._secure = isSecure;
return this;
};
return Cookie;
}(econda.base.BaseClass));
cookie.Cookie = Cookie; // end of class
})(cookie = econda.cookie || (econda.cookie = {}));
})(econda || (econda = {})); // end of module