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) {
|
||||||
|
return new Promise ((resolve, reject) => {
|
||||||
const timeStart = +new Date()
|
const timeStart = +new Date()
|
||||||
const url = `${this._baseUrl}/exposure?exposure=${exposure}`
|
const url = `${this._baseUrl}/exposure?exposure=${exposure}`
|
||||||
//console.log(url)
|
//console.log(url)
|
||||||
req(url, (err, res, body) => {
|
return req(url, (err, res, body) => {
|
||||||
let ms = (+new Date()) - timeStart
|
let ms = (+new Date()) - timeStart
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
return reject(err)
|
||||||
}
|
}
|
||||||
cb(ms)
|
return resolve(ms)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
connect (cb) {
|
connect (cb) {
|
||||||
|
|
Loading…
Reference in New Issue