Skip to content

dualjack/svelte-tools

Repository files navigation

Simple wrapper Svelte tools

Why? Because runes are not safe to toss around by design.

I am not a fan of some patterns in svelte, so I buckled up and created a set of utility tools for svelte users.

It's highly based on some Vue3 Composition API methods.

Everything is up-to-date with the newest svelte 5 runes.

No support for svelte 4.

watch

watch(() => something, (newValue, oldValue) => {
    
}, {
    lazy: true, //  Do not run on mount.
    pre: true   //  Before DOM changes
});

ref

const something = ref('123');
something.current = '1234';

computed

const something = computed(() => {
    return '123'
});

fromStoreToWayBinding

const something = fromStoreToWayBinding(existingStore);
something.current = '123';  //  Changes will be applied both in store and in rune.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published