Last active
January 16, 2020 13:36
-
-
Save WoonHaKim/1e520f86f6f61633d68ca5d8684833b9 to your computer and use it in GitHub Desktop.
Callback to Promise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {someApi} from "someApi" | |
const somePromiseFct = (params) => { | |
return new Promise((resolve, reject) => { | |
//... ex. callbackFct는 callback으로 data를 준다고 합니다 | |
someApi.callbackFct(params, (data, error) => { | |
//... data를 처리 | |
if (error) return reject(error); | |
resolve(data); | |
}) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment