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",