Skip to content
On this page

useOnline

Category
Last Changed
3 months ago

Reactive online state. A wrapper of useNetwork

Demo

Disconnect your network to see changes
Status: Online

Usage

import { useOnline } from '@vueuse/core'

const online = useOnline()
import { useOnline } from '@vueuse/core'

const online = useOnline()

Component

This function also provides a renderless component version via the @vueuse/components package. Learn more about the usage.
<UseOnline v-slot="{ isOnline }">
  Is Online: {{ isOnline }}
</UseOnline>
<UseOnline v-slot="{ isOnline }">
  Is Online: {{ isOnline }}
</UseOnline>

Type Declarations

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

Source

SourceDemoDocs

Contributors

Anthony Fu
Mike Jules
wheat
Alex Kozack
Antério Vieira

Changelog

v5.0.0-beta.2 on 5/25/2021
5bede - feat: introduce components & directives (#486)
useOnline has loaded