import JSONFunctions from "../../Types/JSONFunctions";
import Typeof from "../../Types/Typeof";
export default class SessionStorage {
    static setItem(key, value) {
        if (typeof value === Typeof.Object) {
            // if of type jsonobject.
            value = JSON.stringify(JSONFunctions.serializeValue(value));
        }
        sessionStorage.setItem(key, value);
    }
    static getItem(key) {
        const value = sessionStorage.getItem(key);
        try {
            if (value) {
                return JSONFunctions.deserializeValue(JSONFunctions.parse(value === null || value === void 0 ? void 0 : value.toString()));
            }
            return value;
        }
        catch (_a) {
            return value;
        }
    }
    static removeItem(key) {
        return sessionStorage.removeItem(key);
    }
    static clear() {
        sessionStorage.clear();
    }
    static getAllItems() {
        return Object.assign({}, sessionStorage);
    }
}
//# sourceMappingURL=SessionStorage.js.map