TorchPlugin.getTorchState()
August 11, 2023
- Plugin
Get the status of the flashlight
TorchPlugin.getTorchState()
parameters
- none
return value
Return a Promise, resolve to fulfill a boolean; A value describing whether the torch is off;
Example
import { torchPlugin } from "@plaoc/plugin";
;(async () => {
const b = await torchPlugin.getTorchState()
console.log(b ? "手电筒打开中" : "手电同关闭中")
})();
Platform Compatibility
Property/Method/Event | Android | IOS | Desktop-Dev | Desktop |
---|---|---|---|---|
getTorchState | ✅ | ✅ | ✅ | X |
Related Links
Powered by Waline v2.13.0