Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fire resolving event #389

Closed
AbrahemAlhofe opened this issue Jun 9, 2022 · 2 comments
Closed

fire resolving event #389

AbrahemAlhofe opened this issue Jun 9, 2022 · 2 comments

Comments

@AbrahemAlhofe
Copy link

What problem is this solving

There are some functions I wana to do on my element after the promise has been resolved using Promise component

<template>
<Promised :promise="user">
     <div class="box">Hello {{ user.name }}</div>
</Promised>
</template>
<script>
export default {

    computed: {
        
        user () { return fetch("/users/me") }
    
    },

    mounted () {

        $(".box").style({ color: "red" })

    }

}
</script>

Proposed solution

we can make Promised component fires a resolve event after the promise has been resolved and the slot has been mounted

<template>
<Promised :promise="user" @resolved="color">
     <div class="box">Hello {{ user.name }}</div>
</Promised>
</template>
<script>
export default {

    computed: {
        
        user () { return fetch("/users/me") }
    
    },

    methods: {

        color () {

           $(".box").style({ color: "red" })

        }

    }

}
</script>
@posva
Copy link
Owner

posva commented Jun 9, 2022

Duplicate of #311

@posva posva marked this as a duplicate of #311 Jun 9, 2022
@posva posva closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2022
@posva
Copy link
Owner

posva commented Jun 9, 2022

Please, search existing issues and pull requests before opening issues, it saves maintainers a lot of time 🙏

Repository owner locked and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants