network
intro:
Network status plugin
Reference
Method
onLine
Check if the network is online
ts
import { networkPlugin } from "@plaoc/plugins";
await networkPlugin.onLine();
getStatus
Get network status
ts
import { networkPlugin } from "@plaoc/plugins";
await networkPlugin.getStatus();
Usage Plugins
vue
<script setup lang="ts">
import { networkPlugin } from "@plaoc/plugins";
async function getNetworkState() {
const state = networkPlugin.onLine();
const status = networkPlugin.getStatus();
}
</script>
Usage WebComponent
vue
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { HTMLDwebNetworkElement } from "@plaoc/plugins";
let $networkPlugin = ref<HTMLDwebNetworkElement>();
let network: HTMLDwebNetworkElement;
onMounted(() => {
network = $networkPlugin.value!;
});
async function getNetworkState() {
const state = network.onLine();
const status = network.getStatus();
}
</script>
<template>
<dweb-network ref="$networkPlugin"></dweb-network>
</template>