DEV Community

Discussion on: Create the Perfect Sharable Rune in Svelte

Collapse
 
geweldon profile image
Grant Weldon

Overriding the valueOf() function in your rune code will allow you to access the value from within the svelte brackets without needing to type out the property name.

Image description

Image description

Collapse
 
jdgamble555 profile image
Jonathan Gamble

Yes, but you can't set the new value to something like you can $state, otherwise it would reassign the variable.

Collapse
 
geweldon profile image
Grant Weldon

True, a rather unfortunate downside.