async-props icon indicating copy to clipboard operation
async-props copied to clipboard

Promise support

Open kinday opened this issue 8 years ago • 2 comments

Hey, I’d like to use async-props in my current project, but it lacks Promise support. How about mixing new and old school, huh?

If you like the idea, I’m willing to implement this feature myself.

kinday avatar Apr 26 '16 17:04 kinday

static loadProps(params, cb) {
    Promise.resolve({ilike: 'turtles'}).then(cb);
}

nelix avatar Sep 13 '16 11:09 nelix

@kinday please do – I'd much rather Promise support than the old-fashioned callback approach. We could then go a step further with allowing static async function:

static async loadProps(params) {
    
    const user = await getUser(params.user);
    const photos = await getPhotos(user);
    
    return { user, photos };
    
}

Wildhoney avatar Jan 06 '17 15:01 Wildhoney