https://github.com/nju33/hai
:hand: A small conversation library that happens at hand
https://github.com/nju33/hai
dialog javascript library
Last synced: 11 months ago
JSON representation
:hand: A small conversation library that happens at hand
- Host: GitHub
- URL: https://github.com/nju33/hai
- Owner: nju33
- License: mit
- Created: 2016-11-27T09:09:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-18T07:04:35.000Z (over 9 years ago)
- Last Synced: 2024-12-22T13:02:41.052Z (over 1 year ago)
- Topics: dialog, javascript, library
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@nju33/hai
- Size: 4.85 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
Hai
[](https://github.com/sindresorhus/xo) [](https://travis-ci.org/nju33/hai) 
✋ A small conversation library that happens at hand

## Install, or Download
### npm
```sh
$ npm i -S @nju33/hai
```
### yarn
```sh
$ yarn add @nju33/hai
```
### bower
```sh
$ bower i -S hai
```
### Download
Access to [releases page](https://github.com/nju33/hai/releases).
Then, download the latest version.
## Usage
### Bandler
> (e.g.) webpack, browserify, rollup...
```js
// es
import Hai from '@nju33/hai';
// common
const Hai = require('@nju33/hai');
```
### Browser
```html
// Your JS code.
```
## API
### `hai = new Hai(talks)`
Create an instance of Hai that Contains information about talk elements or callbacks. It can be used by passing it to openWith.
### `Hai.config`
### `Hai.config.theme`
Dark(default) or light.
#### `talk.name`
Use for prefix of callback name.
#### `talk.message`
What I'd like to talk about here.
#### `talk.convenient`
##### `talk.convenient.type`
Various types. (e.g. `text`, `input`, `radio`, `checkbox`)
Note that property values that you have to pass depend on type change
###### `type: text`
Please write the text you want displayed in the `text` property. This is used when you want to display longer text.
###### `type: radio` or `type: checkbox`
Please write the text you want displayed in the `items` property. Use this if you want to give the client choices.
This is the only difference.
- `radio`
Select only one.
- `checkbox`
Multiple selection.
TODO....
##### `type: input`
TODO...
#### `hai.open`
TODO...
`hai.open.then(answers => ...)`;
## Related
- [vue-hai](https://github.com/nju33/vue-hai)
- [react-hai](https://github.com/nju33/react-hai)
## LICENSE
The MIT License (MIT)
Copyright (c) 2016 nju33