Created
March 11, 2022 16:38
-
-
Save MohammadAzimi/c6fec8816f50e779b551fd13e951c0f5 to your computer and use it in GitHub Desktop.
example of converting callback function to promise
This file contains 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
const popInitialNotificationPromise = () => | |
new Promise((resolve, reject) => { | |
PushNotification.popInitialNotification((notification) => { | |
if (notification) { | |
resolve(notification); | |
} else { | |
resolve(undefined); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment