From f70be6a45f8366c2dddb74929dfb3613a32429a6 Mon Sep 17 00:00:00 2001 From: ztimson Date: Sun, 7 Jan 2024 17:06:20 -0500 Subject: [PATCH] Updated documentation --- README.md | 20 +++++++++++--------- package.json | 9 ++++++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6a6f893..b3512c6 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ Logo - ### Persist + ### var-persist - Typescript Library to Sync Variables with LocalStorage + TypeScript: Sync variables with localStorage [![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/persist/tags&query=$[0].name)](https://git.zakscode.com/ztimson/persist/tags) @@ -29,7 +29,7 @@ ## Table of Contents -- [Persist](#top) +- [var-persist](#top) - [About](#about) - [Examples](#examples) - [Built With](#built-with) @@ -44,7 +44,7 @@ ## About -Persist is an updated version of [webstorage-decorators](https://git.zakscode.com/ztimson/webstorage-decorators), a library which saves variables to local or session storage. +Var-Persist is an updated version of [webstorage-decorators](https://git.zakscode.com/ztimson/webstorage-decorators), a library which saves variables to local or session storage. This library aims to improve upon the original's limitations by using the new [Proxy Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy). Improvements include: - Supports both OOP & Decorator patterns @@ -57,7 +57,7 @@ This library aims to improve upon the original's limitations by using the new [P Using objects: ```ts -import {Persist} from 'ztimson/persist'; +import {Persist} from 'var-persist'; // Proxy Object (Always access/modify using `.value`): let theme = new Persist('theme', {default: 'os'}); @@ -68,7 +68,7 @@ theme.value = 'light'; // Changes will be synced to localStorage['theme']; Using decorators: ```ts -import {persist} from 'ztimson/persist'; +import {persist} from 'var-persist'; // Using decorators class Theme { @@ -83,7 +83,7 @@ theme.current = 'dark'; // You can ommit `.value` when using the decorator Advanced uses: ```ts -import {Persist} from 'ztimson/persist'; +import {Persist} from 'var-persist'; // Options are the same for both the persist decorator and object: let example = new Persist('example', { @@ -117,7 +117,7 @@ example.value.pop(); // Impure changes are saved - [Node.js](https://nodejs.org/en/download) #### Instructions -1. Install persist: `npm i ztimson/persist` +1. Install persist: `npm i var-persist` 2. Enable decorators inside `tsconfig.json`: ```json { @@ -165,7 +165,7 @@ Your data is stored under the `value` property and should always be accessed/mod #### Example ```ts -import {Persist} from 'ztimson/persist' +import {Persist} from 'var-persist' const theme = new Persist('theme.current', {default: 'os'}); @@ -266,6 +266,8 @@ Your data is stored under the value property and should always be accessed/modif #### Example ```ts +import {Persist} from 'var-persist'; + class Theme { // This property will automatically sync with localStorage @Persist({default: 'os'}) current!: string; diff --git a/package.json b/package.json index 980017c..243379d 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,11 @@ { - "name": "persist", - "version": "1.0.3", + "name": "var-persist", + "version": "1.0.0", "description": "Sync variables with the local/session storage using proxy objects & decorators", - "repository": "https://git.zakscode.com/ztimson/persistance", + "repository": { + "type": "git", + "url": "https://git.zakscode.com/ztimson/var-persist" + }, "author": "Zak Timson", "license": "MIT", "main": "dist/index.js",