Skip to content

useOnline ​

Category
Export Size
830 B
Last Changed
2 months ago

Reactive online state. A wrapper of useNetwork

Demo ​

Disconnect your network to see changes
Status: Online

Usage ​

js
import { useOnline } from '@vueuse/core'

const online = useOnline()

Component Usage ​

This function also provides a renderless component version via the @vueuse/components package. Learn more about the usage.

vue
<template>
  <UseOnline v-slot="{ isOnline }">
    Is Online: {{ isOnline }}
  </UseOnline>
</template>

Type Declarations ​

typescript
/**
 * Reactive online state.
 *
 * @see https://vueuse.org/useOnline
 * @param options
 */
export declare function useOnline(
  options?: ConfigurableWindow,
): Readonly<Ref<boolean, boolean>>

Source ​

Source • Demo • Docs

Contributors ​

Anthony Fu
Anthony Fu
vaakian X
Mike Jules
wheat
Alex Kozack
Antério Vieira

Changelog ​

v9.11.0 on 1/17/2023
d5321 - fix(components): mark defineComponent as pure (#2623)

Released under the MIT License.