Skip to main content

TorchPlugin.getTorchState()

BFChainPluginTorchPlugingetTorchStateLess than 1 minute

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/plugins";
;(async () => {
  const b = await torchPlugin.getTorchState()
  console.log(b ? "手电筒打开中" : "手电同关闭中")
})();

Platform Compatibility

Property/Method/EventAndroidIOSDesktop-DevDesktop
getTorchStateX

TorchPlugin

Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v2.15.7