v0.11.7 - *Effectively* manage side effects!
Features
- feat: include
Effectful
from Lume'sclassy-solid
package as a feature of LumeElement, adding a convenientcreateEffect()
class method for making effects and not having to manually clean them up indisconnectedCallback()
.
Before:
// ...
import {createRoot, createEffect} from 'solid-js'
@element('my-el')
class MyEl extends LumeElement {
// ...
#stop = () => {}
connectedCallback() {
super.connectedCallback()
createRoot(stop => {
this.#stop = stop
// create effects
createEffect(() => {...})
createEffect(() => {...})
})
}
disconnectedCallback() {
super.disconnectedCallback()
this.#stop()
}
}
After:
// ...
import {createRoot, createEffect} from 'solid-js'
@element('my-el')
class MyEl extends LumeElement {
// ...
connectedCallback() {
super.connectedCallback()
// create effects
this.createEffect(() => {...})
this.createEffect(() => {...})
}
}
Full Changelog: v0.11.0...v0.11.7