← Snippets

Promise for Callback Function

1return new Promise((resolve, reject) => {
2 functionWithCallback(cbValue => {
3 resolve(cbValue)
4 })
5 .on('error', err => {
6 reject('Error: ' + err.message)
7 })
8}
9
Site Logo - Andrew Lazenka
© 2021 Andrew Lazenka. All Rights Reserved.