Make all functions in intval async/await

This commit is contained in:
mmcwilliams 2018-03-04 23:54:42 -05:00
parent 3e80925aaa
commit 8d8ce64ff7
1 changed files with 11 additions and 9 deletions

View File

@ -35,15 +35,17 @@ class Intval {
})
}
async setExposure (exposure, cb) {
const timeStart = +new Date()
const url = `${this._baseUrl}/exposure?exposure=${exposure}`
//console.log(url)
req(url, (err, res, body) => {
let ms = (+new Date()) - timeStart
if (err) {
console.error(err)
}
cb(ms)
return new Promise ((resolve, reject) => {
const timeStart = +new Date()
const url = `${this._baseUrl}/exposure?exposure=${exposure}`
//console.log(url)
return req(url, (err, res, body) => {
let ms = (+new Date()) - timeStart
if (err) {
return reject(err)
}
return resolve(ms)
})
})
}
connect (cb) {