zents
Version:
ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.
34 lines • 955 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SessionStore = void 0;
const get_1 = require("../utils/get");
const set_1 = require("../utils/set");
const unset_1 = require("../utils/unset");
class SessionStore {
constructor(sessionId, data, adapter) {
this.sessionId = sessionId;
this.data = data;
this.adapter = adapter;
this.isModified = false;
}
async save() {
if (!this.isModified) {
return;
}
await this.adapter.persist(this.sessionId, this.data);
this.isModified = false;
}
get(path) {
return get_1.get(this.data, path);
}
set(path, value) {
set_1.set(this.data, path, value);
this.isModified = true;
}
remove(path) {
unset_1.unset(this.data, path);
this.isModified = true;
}
}
exports.SessionStore = SessionStore;
//# sourceMappingURL=SessionStore.js.map