UNPKG

fabric8-planner

Version:
36 lines 1.39 kB
import { Injectable } from '@angular/core'; var CookieService = /** @class */ (function () { function CookieService() { // Increase this by one everytime // a change is made in the table columns this.datatableColumnVersion = 4; } CookieService.prototype.setCookie = function (cName, cValue) { document.cookie = cName + '=' + JSON.stringify({ version: this.datatableColumnVersion, value: cValue }); }; CookieService.prototype.getCookie = function (itemLength) { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { if (cookies[i].includes('datatableColumn')) { var data = JSON.parse(cookies[i].split('=')[1]); if (Object.keys(data).length === 2) { if (data['version'] === this.datatableColumnVersion && data['value'].length === itemLength) { return { status: true, array: data['value'] }; } } } } return { status: false, array: [] }; }; CookieService.decorators = [ { type: Injectable }, ]; /** @nocollapse */ CookieService.ctorParameters = function () { return []; }; return CookieService; }()); export { CookieService }; //# sourceMappingURL=cookie.service.js.map