Skip to content

Commit d8e2ad5

Browse files
author
subbu
committed
Ported to TS and updated to furhat-core 0.2.0
1 parent 0085f0b commit d8e2ad5

8 files changed

Lines changed: 14012 additions & 105 deletions

File tree

.eslintrc

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
{
2-
"parser": "babel-eslint",
3-
"extends": [
4-
"airbnb-base",
5-
"plugin:flowtype/recommended"
6-
],
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
74
"plugins": [
8-
"flowtype",
9-
"flowtype-errors"
5+
"@typescript-eslint"
106
],
11-
"env": {
12-
"jest": true
13-
},
14-
"rules": {
15-
"semi": [2, "never"],
16-
"comma-dangle": [2, "always-multiline"],
17-
"flowtype-errors/show-errors": 2
18-
}
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
10+
"plugin:@typescript-eslint/recommended"
11+
]
1912
}

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,27 @@ Client library for connecting to a Furhat skill from a skill GUI
1313
## Usage
1414

1515
```js
16-
import FurhatGUI from 'furhat-gui'
16+
import FurhatGUI, { Furhat } from 'furhat-gui'
1717

18-
FurhatGUI((furhat) => {
19-
furhat.send({
20-
event_name: 'MyEvent',
21-
param1: 'MyParam1'
18+
let furhat: Furhat = null
19+
20+
function setupSubscriptions () {
21+
furhat.subscribe('com.myapp.MyCustomEvent', (event) => {
22+
console.log('received event: ', event.event_name)
2223
})
24+
}
2325

24-
furhat.subscribe('com.myapp.MyCustomeEvent', (event) => {
25-
console.log('recieved event: ', event.event_name)
26+
FurhatGUI()
27+
.then(connection => {
28+
furhat = connection
29+
setupSubscriptions()
2630
})
31+
.catch(console.error)
32+
33+
// Later somewhere in the code (after awaiting for the connection promise)
34+
furhat.send({
35+
event_name: 'MyEvent',
36+
param1: 'MyParam1'
2737
})
2838
```
2939

@@ -40,8 +50,4 @@ FurhatGUI((furhat) => {
4050
FurhatGUI Function which sets up a connection to the furhat skill and gives
4151
the furhat object to send and recieve events to the skill.
4252

43-
**Parameters**
44-
45-
- `callback` callback that needs to be triggered when a sucessful connection is established
46-
47-
Returns **any** Promise that will return the promise of the connection
53+
Returns **any** Promise that will return the promise with a `Furhat` obkect

index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)