lume / lume/element

add `createEffect` method from the `lume`'s Element3D

Open
#11 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.