https://github.com/baptistelambert/hyperapp-network
📡 Notifies your app when the network connection goes online or offline.
https://github.com/baptistelambert/hyperapp-network
hyperapp network render-prop
Last synced: 9 months ago
JSON representation
📡 Notifies your app when the network connection goes online or offline.
- Host: GitHub
- URL: https://github.com/baptistelambert/hyperapp-network
- Owner: baptistelambert
- License: mit
- Created: 2018-02-17T19:31:32.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-22T10:17:45.000Z (almost 8 years ago)
- Last Synced: 2025-05-07T23:02:15.420Z (9 months ago)
- Topics: hyperapp, network, render-prop
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/hyperapp-network
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hyperapp-network
Notifies your app when the network connection goes online or offline.
Inspired by [react-network](https://github.com/ReactTraining/react-network).
## Installation
```
npm install hyperapp-network
# or with yarn
yarn add hyperapp-network
```
## Usage
```js
import { h, app } from 'hyperapp';
import { Network } from 'hyperapp-network';
const state = {
online: window.navigator.onLine
};
const actions = {
updateOnline = online => state => ({ online })
};
const view = (state, actions) => (
{online ? 'Online' : 'Offline'}}
/>
)
app(state, actions, view, document.body);
```