# deventh

**D**eclarative (Synthetic) **E**vent **H**andler

It's a tiny library with handler of events.

It uses [fluent interface](https://en.wikipedia.org/wiki/Fluent_interface#JavaScript) and is inspired by the implementation of [event handling in Vue](https://vuejs.org/v2/guide/events.html).

## Recommendations

Yet it's not ready for production

## Examples

```js
import React from 'react'
import { connect } from 'react-redux'
import deventh from 'deventh'

import photo from './photo.jpg'

@connect()
export default function Photo({ id, dispatch }) {
    const openPhoto = () => dispatch({ type: 'open_photo', id })
    const likePhoto = () => dispatch({ type: 'like_photo', id })
    const handleClick = event => deventh(event)
            .debounce({ ms: 300 })
            .handle((_, n) => switch (n) {
                if (n === 1) {
                    openPhoto()
                } else if (n === 2) {
                    likePhoto()
                }
            })

    return (
        <img src={photo} onClick={handleClick} />
    )
}
```

## Issues

- [x] Add declarative properties
    - [x] Event interuptions
    - [x] Behavioural flags
- [ ] Add event keys
    - [x] Keyboard
    - [ ] Mouse
    - [ ] Touch

## Dependencies

- [schematic-fluent](https://github.com/Kelin2025/schematic-fluent) to organise fluent interface
