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

https://github.com/baptistelambert/hyperapp-idle

😴 Notifies you app when the user is idle.
https://github.com/baptistelambert/hyperapp-idle

hyperapp idle render-prop

Last synced: 8 months ago
JSON representation

😴 Notifies you app when the user is idle.

Awesome Lists containing this project

README

          

# hyperapp-idle

Notifies your app when the user is idle.

Inspired by [react-idle](https://github.com/ReactTraining/react-idle).

## Installation

```
npm install hyperapp-idle
# or with yarn
yarn add hyperapp-idle
```

## Usage

```js
import { h, app } from 'hyperapp';
import { Idle } from 'hyperapp-idle';

const state = {
idle: false
};

const actions = {
updateIdle = idle => state => ({ idle })
};

const view = (state, actions) => (

{idle ? 'You are idle.' : 'You are active.'}
}
/>

)

app(state, actions, view, document.body);
```