add `createEffect` method from the `lume`'s Element3D
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 187
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
`this.createEffect()` will make an effect that is conveniently stopped in `disconnectedCallback`. This is useful for creating effects in `connectedCallback` and then not having to use `createRoot` and `disconnectedCallback` to stop them.
Currently:
```js
connectedCallback() {
super.connectedCallback()
createRoot(dispose => {
this.dispose = dispose
createEffect(() => {
// ...
onCleanup(() => {...})
})
})
}
disconnectedCallback() {
super.disconnectedCallback()
this.dispose()
}
```
Using `this.createEffect`:
```js
connectedCallback() {
super.connectedCallback()
this.createEffect(() => {
// ...
onCleanup(() => {...})
})
}
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the Element3D implementation referenced in the title, then trace the connectedCallback and disconnectedCallback entry points shown in the issue. Done means effects created through the new method during connection are stopped when the element is disconnected, without requiring each component to manage a separate root and disposer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100