Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancing the usage experience of Persisted State #203

Open
vfxturjo opened this issue Jan 7, 2025 · 1 comment
Open

Enhancing the usage experience of Persisted State #203

vfxturjo opened this issue Jan 7, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@vfxturjo
Copy link

vfxturjo commented Jan 7, 2025

Describe the feature in detail (code, mocks, or screenshots encouraged)

Dear developers,
I really love the runed module, it is really useful in making life easier.

However, for the persisted state, accessing the value of a PersistedState requires writing .current every time... I was wondering if there was a way to directly access it, or if not possible at all then write something shorter to access the value.

in the example provided in the docs, we can see it

<script lang="ts">
	import { PersistedState } from "runed";
 
	const count = new PersistedState("count", 0);
</script>
 
<div>
	<button onclick={() => count.current++}>Increment</button>
	<button onclick={() => count.current--}>Decrement</button>
	<button onclick={() => (count.current = 0)}>Reset</button>
	<p>Count: {count.current}</p>
</div>

What type of pull request would this be?

Enhancement

Provide relevant links or additional information.

https://runed.dev/docs/utilities/persisted-state

@vfxturjo vfxturjo added the enhancement New feature or request label Jan 7, 2025
@niemyjski
Copy link

Also, please export the types like Serializer<T> and options so we can implement serializers...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants