Files
nuttyreading-html/pages/yRead/brightness.js
@fawn-nine f8e1a3015b 1
2023-03-03 12:11:23 +08:00

28 lines
440 B
JavaScript

let Brightness=null
const getBrigthness = function(callbck) {
uni.getScreenBrightness({
success: res => {
Brightness=res.value
callbck(res.value*100)
}
})
}
const setBrigthness = function(data,type,callbck) {
uni.setScreenBrightness({
value:type?Brightness:data/100,
success: res => {
if(type){
callbck(Brightness*100)
}else{
callbck(data)
}
}
})
}
export default {
getBrigthness,
setBrigthness
}