5 ms·
function getUserInfo(cb) { Promise.all([ api.getUser(), api.getFriends(), api.getPhoto(), ]).then( ([user, friends,
by tracker1 9y ago
function getUserInfo(cb) {
Promise.all([
api.getUser(),
api.getFriends(),
api.getPhoto(),
]).then(
([user, friends, photo]) =>
cb(null, {user, friends, photo}),
cb,
);
}
- hitgeek 9y agoI do this with so many libraries now. especially in the react-native ecosystem. I just prefer node style callbacks, so I wrap libraries with promise based APIs with callback based wrappers. hopefully i'm not the only one.