torch
intro:
Torch plugin
Reference
Method
toggleTorch
open/close torch
ts
import { torchPlugin } from "@plaoc/plugins";
await torchPlugin.toggleTorch();
getTorchState
get torch state
ts
import { torchPlugin } from "@plaoc/plugins";
await torchPlugin.getTorchState();
Usage Plugins
vue
<script setup lang="ts">
import { torchPlugin } from "@plaoc/plugins";
async function toggleTorch() {
await torchPlugin.toggleTorch();
}
async function getTorchState() {
await torchPlugin.getTorchState();
}
</script>
Usage WebComponent
vue
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { HTMLDwebTorchElement } from "@plaoc/plugins";
const $torchPlugin = ref<HTMLDwebTorchElement>();
let torch: HTMLDwebTorchElement;
onMounted(() => {
torch = $torchPlugin.value!;
});
async function toggleTorch() {
await torch.toggleTorch();
}
async function getTorchState() {
await torch.getTorchState();
}
</script>
<template>
<dweb-torch ref="$torchPlugin"></dweb-torch>
</template>