Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[@lit-labs/task] Tasks that don't start immediately #2323

@justinfagnani

Description

@justinfagnani

It'd be useful to be able to define a task that doesn't start immediately. The task could start on some action / event, or when some other async process is done.

I could imagine two non-exclusive ways to do this:

  1. Have a method to start a task, along with an option to not immediately run a task. That option could be a particular set of deps, as in [@lit-labs/task] Task function never call if there are no deps #2317. Maybe () => [] always runs the task, and undefined creates a manually run task.
  2. Support Promises as deps and only run a task when the promises resolve. This could be tricky when dealing with Promise identity (new Promise instances wrapping the same underlying value) and needing to always wait a microtask to see the Promise value. Some of the same issues that Task solves vs until().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions