/*************************
 * Cookies服务
 */
import {VarService} from "./var.service";

export class CookieService {

  /**********************
   * 获取 cookie值，如果没有，返回default值
   */
  public static get(key: string, value?: any): any {
    if (VarService.COOKIE_SERVICE.check(key))
      return VarService.COOKIE_SERVICE.get(key);
    return value;
  }

  /***************************
   * 设置cookies值
   */
  public static set(key: string, value: any): void {
    VarService.COOKIE_SERVICE.set(key, value);
  }

  /************************
   * 删除一个cookie
   */
  public static del(key: string): void {
    VarService.COOKIE_SERVICE.delete(key);
  }
}
