Skip to content

Accessing component reference/state inside running task #80

@mdcarreira

Description

@mdcarreira

I've read the open issue that presents a problem similar to mine, but the discussion digressed and I couldn't find a solution to the problem. So I'm opening this new issue.

I used ember-concurrency when developing in Ember, and was very happy when I found that this port exists for vue.

In Ember, we can use this to access component's state while performing a task. Unfortunately, I couldn't find a way to do the same in vue-concurrency. This would be very useful to access variables, functions, using this.$emit to emit events, etc.

I could implement it by making the task receive the component instance as an argument, but this feels a bit weird... Passing the component instance as argument does not feel right.

I found that there is a useAsyncTask() that could be defined using the arrow function and therefore would run in the same context. But for some reason this is undefined while executing the task.

image

Is there any other way to access the component instance while a task is being executed that I missed? Or this is not possible at all?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions