Internet connection detector to Svelte
npm i svelte-internet-connection
// OR
yarn add svelte-internet-connection
Note: to use this library in sapper, install as devDependency. See the link.
Local demo:
git clone https://github.com/andrelmlins/svelte-internet-connection.git
cd svelte-internet-connection
npm install && npm run dev
An example of how to use the library:
<script>
import InternetConnection from "svelte-internet-connection";
</script>
<InternetConnection let:status>
Status: {status}
</InternetConnection>
Prop | Type | Description |
---|---|---|
change | func | Call with change connection |
Prop | Type | Description |
---|---|---|
status | string | Connection status |
online | bool | Tells if there is a connection |
offline | bool | Tells if there is no connection |
Download stats for this NPM package
Svelte Internet Connection is open source software licensed as MIT.