import * as store from 'store'; import Trending from './Trending'; class Storage { /** * * * @type {string} */ private daypart: string; /** * * * @param {string} daypart * @return {Storage} */ public constructor(daypart: string) { this.daypart = daypart; } /** * * * @return {string} */ public get storageKey() { return this.daypart + '-trending'; } /** * * * @return {Trending | null} */ public get() { return JSON.parse(store.get(this.storageKey, null)); } /** * * * @param {Trending} trending * @return {Trending} */ public set(trending: Trending) { return store.set(this.storageKey, JSON.stringify(trending)); } } export default Storage;