Make all functions in intval async/await
This commit is contained in:
parent
3e80925aaa
commit
8d8ce64ff7
|
@ -35,15 +35,17 @@ class Intval {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
async setExposure (exposure, cb) {
|
async setExposure (exposure, cb) {
|
||||||
const timeStart = +new Date()
|
return new Promise ((resolve, reject) => {
|
||||||
const url = `${this._baseUrl}/exposure?exposure=${exposure}`
|
const timeStart = +new Date()
|
||||||
//console.log(url)
|
const url = `${this._baseUrl}/exposure?exposure=${exposure}`
|
||||||
req(url, (err, res, body) => {
|
//console.log(url)
|
||||||
let ms = (+new Date()) - timeStart
|
return req(url, (err, res, body) => {
|
||||||
if (err) {
|
let ms = (+new Date()) - timeStart
|
||||||
console.error(err)
|
if (err) {
|
||||||
}
|
return reject(err)
|
||||||
cb(ms)
|
}
|
||||||
|
return resolve(ms)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
connect (cb) {
|
connect (cb) {
|
||||||
|
|
Loading…
Reference in New Issue