Skip to content

Latest commit

 

History

History
30 lines (18 loc) · 621 Bytes

File metadata and controls

30 lines (18 loc) · 621 Bytes

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