import { defineAsyncApi, API_GET_SCREEN_BRIGHTNESS, API_TYPE_GET_SCREEN_BRIGHTNESS, API_SET_SCREEN_BRIGHTNESS, API_TYPE_SET_SCREEN_BRIGHTNESS, API_SET_KEEP_SCREEN_ON, API_TYPE_SET_KEEP_SCREEN_ON, } from '@dcloudio/uni-api' export const getScreenBrightness = defineAsyncApi( API_GET_SCREEN_BRIGHTNESS, (_, { resolve }) => { const value = plus.screen.getBrightness(false) resolve({ value }) } ) export const setScreenBrightness = defineAsyncApi( API_SET_SCREEN_BRIGHTNESS, (options, { resolve }) => { plus.screen.setBrightness(options.value, false) resolve() } ) export const setKeepScreenOn = defineAsyncApi( API_SET_KEEP_SCREEN_ON, (options, { resolve }) => { plus.device.setWakelock(!!options.keepScreenOn) resolve() } )