An open API service indexing awesome lists of open source software.

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.

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);
```