From f27014af14b273a7520189ad6bfd6ea7e60a0e99 Mon Sep 17 00:00:00 2001 From: ztimson Date: Tue, 2 Feb 2021 00:05:08 -0500 Subject: [PATCH] Updated docs --- README.md | 9 +++++---- package.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a04d287..c408610 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,15 @@ for persisting themes or local settings over reloads or maintaining filters/sear import {LocalStorage, SessionStorage} from 'webstorage-decorators'; export class MyCustomClass { - @LocalStorage({key: 'site_theme', default: 'light_theme'}) theme: string; - @SessionStorage({encryptWith: config.entryptionKey}) thisUser: User; + @LocalStorage('light_theme', {key: 'site_theme'}) theme: string; + @SessionStorage(null, {encryptWith: config.entryptionKey}) thisUser: User; + @SessionStorage() searchBar: string; - constructor() { + constructor() { console.log(this.theme, localStorage.getItem('theme')); // Output: 'light_theme', 'light_theme' console.log(this.user, localStorage.getItem('user')); // Output: null, undefined user = {first: 'John', last: 'Smith', ...} - console.log(this.user, this.user == localStorage.getItem('user')); // Output: {first: 'John', last: 'Smith', ...}, true + console.log(this.user, localStorage.getItem('user')); // Output: {first: 'John', last: 'Smith', ...}, **Some encrypted value** } } ``` diff --git a/package.json b/package.json index 50046aa..51f2488 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webstorage-decorators", - "version": "3.2.5", + "version": "3.2.6", "description": "Decorators to sync class properties to Local/Session storage", "repository": "https://github.com/ztimson/WebstorageDecorators", "main": "./lib/index.js",