Skip to content

add createEffect method from the lume's Element3D #11

Open
@trusktr

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:

connectedCallback() {
  super.connectedCallback()
  
  createRoot(dispose => {
    this.dispose = dispose
    createEffect(() => {
      // ...
      onCleanup(() => {...})
    })
  })
}

disconnectedCallback() {
  super.disconnectedCallback()
  this.dispose()
}

Using this.createEffect:

connectedCallback() {
  super.connectedCallback()
  
  this.createEffect(() => {
    // ...
    onCleanup(() => {...})
  })
}

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions