0.1.0 • Published 3 years ago

furhat-gui v0.1.0

Weekly downloads
54
License
MIT
Repository
github
Last release
3 years ago

furhat-gui

Generated with nod NPM version Build Status Coverage Status

Client library for connecting to a Furhat skill from a skill GUI

Install

$ npm install --save furhat-gui

Usage

import FurhatGUI, { Furhat } from 'furhat-gui'

let furhat: Furhat = null

function setupSubscriptions () {
    furhat.subscribe('com.myapp.MyCustomEvent', (event) => {
        console.log('received event: ', event.event_name)
    })
}

FurhatGUI()
    .then(connection => {
        furhat = connection
        furhat.onConnectionError((_connection: WebSocket, ev: globalThis.Event) => {
            console.error("Error occured while connecting to Furhat skill")
        })
        furhat.onConnectionClose(() => {
            console.warn("Connection with Furhat skill has been closed")
        })
        setupSubscriptions()
    })
    .catch(console.error)

// Later somewhere in the code (after awaiting for the connection promise)
furhat.send({
    event_name: 'MyEvent',
    param1: 'MyParam1'
})

API

Table of Contents

FurhatGUI

FurhatGUI Function which sets up a connection to the furhat skill and gives the furhat object to send and recieve events to the skill.

Returns any Promise that will return the promise with a Furhat obkect

0.1.0

3 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago