14fbd7d08917dfa2aa10b44fa5d6bb6cb2831d43
				
			
			
		
	Table of Contents
About
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Demo
Website: https://git.zakscode.com
Built With
Setup
  
    Production
  
Prerequisites
Instructions
- Install persist: 
npm i ztimson/persist - Enable decorators inside 
tsconfig.json: 
{
	"compilerOptions": {
		"experimentalDecorators": true,
		...
	},
	...
}
- Use persist:
 
import {Persist, persist} from 'ztimson/persist';
let theme = new Persist<string>('theme', {default: 'os'});
theme.value = 'light'; // Any changes will be synced to localStorage['theme'];
// You have to access/modify your data through the `value` property while using the Persist object
// Or via decorator
class Theme {
	// We are overriding the default key to use the same localStorage as above
	@persist({key: 'theme', default: 'os'}) current!: string;
}
theme = new Theme();
console.log(theme.current); // Output: light
theme.current = 'dark'; // You can ommit `.value` when using the decorator
  
    Development
  
Prerequisites
Instructions
- Install the dependencies: 
npm i - Build library & docs: 
npm build - Run unit tests: 
npm test 
License
Copyright © 2023 Zakary Timson | Available under MIT Licensing
See the license for more information.
Description
				TypeScript: Sync variables with localStorage
						
						
							
								 https://www.npmjs.com/package/var-persist
							
						
						
						
						
							
								 Readme
							
						
						
						
						
							
							
							 227 KiB
						
					
					Languages
				
				
								
								
									TypeScript
								
								96.9%
							
						
							
								
								
									JavaScript
								
								3.1%