@manojadams/session-store
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -1,2 +0,2 @@ | ||
module.exports=/*#__PURE__*/function(){function t(t){this.__sessionData=void 0,this._name=void 0,this._createdAt=void 0,this._updatedAt=void 0,this.isReady=void 0,this._name=t||this.constructor.name,this.__sessionData={},this._createdAt=new Date,this._updatedAt=new Date,this.isReady=!1}var s=t.prototype;return s.init=function(){var t=sessionStorage.getItem(this._name);t&&(this.__sessionData=JSON.parse(t))},s.getData=function(t){return this.__sessionData[t]},s.setData=function(t,s){this.__sessionData[t]=s,this._updatedAt=new Date},s.destroy=function(){var t=this.getData("_createdAt")||this._createdAt.toISOString(),s=this._updatedAt.toISOString();this.setData("_createdAt",t),this.setData("_updatedAt",s),sessionStorage.setItem(this._name,JSON.stringify(this.__sessionData))},t}(); | ||
module.exports=/*#__PURE__*/function(){function t(t){this.__sessionData=void 0,this._name=void 0,this._createdAt=void 0,this._updatedAt=void 0,this.isReady=void 0,this._name=t||this.constructor.name,this.__sessionData={},this._createdAt=new Date,this._updatedAt=new Date,this.isReady=!1}var s=t.prototype;return s.init=function(){var t=sessionStorage.getItem(this._name);t&&(this.__sessionData=JSON.parse(t))},s.getData=function(t){return this.__sessionData[t]},s.setData=function(t,s){this.__sessionData[t]=s,this._updatedAt=new Date},s.destroy=function(){var t=this.__sessionData._createdAt||this._createdAt.toISOString(),s=this._updatedAt.toISOString();this.__sessionData._createdAt=t,this.__sessionData._updatedAt=s,sessionStorage.setItem(this._name,JSON.stringify(this.__sessionData))},t}(); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var t=/*#__PURE__*/function(){function t(t){this.__sessionData=void 0,this._name=void 0,this._createdAt=void 0,this._updatedAt=void 0,this.isReady=void 0,this._name=t||this.constructor.name,this.__sessionData={},this._createdAt=new Date,this._updatedAt=new Date,this.isReady=!1}var s=t.prototype;return s.init=function(){var t=sessionStorage.getItem(this._name);t&&(this.__sessionData=JSON.parse(t))},s.getData=function(t){return this.__sessionData[t]},s.setData=function(t,s){this.__sessionData[t]=s,this._updatedAt=new Date},s.destroy=function(){var t=this.getData("_createdAt")||this._createdAt.toISOString(),s=this._updatedAt.toISOString();this.setData("_createdAt",t),this.setData("_updatedAt",s),sessionStorage.setItem(this._name,JSON.stringify(this.__sessionData))},t}();export{t as default}; | ||
var t=/*#__PURE__*/function(){function t(t){this.__sessionData=void 0,this._name=void 0,this._createdAt=void 0,this._updatedAt=void 0,this.isReady=void 0,this._name=t||this.constructor.name,this.__sessionData={},this._createdAt=new Date,this._updatedAt=new Date,this.isReady=!1}var s=t.prototype;return s.init=function(){var t=sessionStorage.getItem(this._name);t&&(this.__sessionData=JSON.parse(t))},s.getData=function(t){return this.__sessionData[t]},s.setData=function(t,s){this.__sessionData[t]=s,this._updatedAt=new Date},s.destroy=function(){var t=this.__sessionData._createdAt||this._createdAt.toISOString(),s=this._updatedAt.toISOString();this.__sessionData._createdAt=t,this.__sessionData._updatedAt=s,sessionStorage.setItem(this._name,JSON.stringify(this.__sessionData))},t}();export{t as default}; | ||
//# sourceMappingURL=index.modern.js.map |
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).sessionStore=e()}(this,function(){/*#__PURE__*/ | ||
return function(){function t(t){this.__sessionData=void 0,this._name=void 0,this._createdAt=void 0,this._updatedAt=void 0,this.isReady=void 0,this._name=t||this.constructor.name,this.__sessionData={},this._createdAt=new Date,this._updatedAt=new Date,this.isReady=!1}var e=t.prototype;return e.init=function(){var t=sessionStorage.getItem(this._name);t&&(this.__sessionData=JSON.parse(t))},e.getData=function(t){return this.__sessionData[t]},e.setData=function(t,e){this.__sessionData[t]=e,this._updatedAt=new Date},e.destroy=function(){var t=this.getData("_createdAt")||this._createdAt.toISOString(),e=this._updatedAt.toISOString();this.setData("_createdAt",t),this.setData("_updatedAt",e),sessionStorage.setItem(this._name,JSON.stringify(this.__sessionData))},t}()}); | ||
return function(){function t(t){this.__sessionData=void 0,this._name=void 0,this._createdAt=void 0,this._updatedAt=void 0,this.isReady=void 0,this._name=t||this.constructor.name,this.__sessionData={},this._createdAt=new Date,this._updatedAt=new Date,this.isReady=!1}var e=t.prototype;return e.init=function(){var t=sessionStorage.getItem(this._name);t&&(this.__sessionData=JSON.parse(t))},e.getData=function(t){return this.__sessionData[t]},e.setData=function(t,e){this.__sessionData[t]=e,this._updatedAt=new Date},e.destroy=function(){var t=this.__sessionData._createdAt||this._createdAt.toISOString(),e=this._updatedAt.toISOString();this.__sessionData._createdAt=t,this.__sessionData._updatedAt=e,sessionStorage.setItem(this._name,JSON.stringify(this.__sessionData))},t}()}); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -6,4 +6,4 @@ import { IStore } from "./constants"; | ||
*/ | ||
declare abstract class SessionStore<T extends IStore> { | ||
protected __sessionData: T; | ||
declare abstract class SessionStore<T> { | ||
protected __sessionData: T & IStore; | ||
protected _name: string; | ||
@@ -15,3 +15,3 @@ protected _createdAt: Date; | ||
init(): void; | ||
protected getData(dataKey: keyof T): T[keyof T]; | ||
protected getData(dataKey: keyof T): (T & IStore)[keyof T]; | ||
protected setData(dataKey: keyof T, value: any): void; | ||
@@ -18,0 +18,0 @@ destroy(): void; |
{ | ||
"name": "@manojadams/session-store", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Simple state management with session storage", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
15857