Skip to content

Creates a reactive state object with Svelte 5 runes that acts like a plain object while maintaining reactivity through getters/setters and providing utility methods.

License

Notifications You must be signed in to change notification settings

cristianvogel/state-facade-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Service Class

Even safer solution, with read/write access and generated accessors! My example is for managing the front-end state of a Tauri app.

Usage Example

import { MyService } from './path/to/your/service';

// Access current state
const currentState = MyService.current;

// Update state
MyService.someProperty = newValue;

// Get snapshot
const stateSnapshot = MyService.snapshot;

Features

  • Dynamic Accessors: Automatically generated getters and setters for state properties.
  • Type Safety: Ensures correct types for read/write operations.

License

MIT

About

Creates a reactive state object with Svelte 5 runes that acts like a plain object while maintaining reactivity through getters/setters and providing utility methods.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published