svelte-internet-connection

Internet connection detector to Svelte

Usage no npm install needed!

<script type="module">
  import svelteInternetConnection from 'https://cdn.skypack.dev/svelte-internet-connection';
</script>

README

Svelte Internet Connection

npm versionLicense: MITBuild StatusNetlify Status

Internet connection detector to Svelte

Installation

npm i svelte-internet-connection
// OR
yarn add svelte-internet-connection

Note: to use this library in sapper, install as devDependency. See the link.

Demo Link

Local demo:

git clone https://github.com/andrelmlins/svelte-internet-connection.git
cd svelte-internet-connection
npm install && npm run dev

Examples

An example of how to use the library:

<script>
  import InternetConnection from "svelte-internet-connection";
</script>

<InternetConnection let:status>
  Status: {status}
</InternetConnection>

Events

Prop Type Description
change func Call with change connection

Slot Properties

Prop Type Description
status string Connection status
online bool Tells if there is a connection
offline bool Tells if there is no connection

NPM Statistics

Download stats for this NPM package

NPM

License

Svelte Internet Connection is open source software licensed as MIT.