Kind: global class
| Param | Type | Default | Description |
|---|---|---|---|
| username | String |
UserA |
The client's user username |
| userTag | String |
000000000000000000000000 |
The client's user tag |
Example
let chat = new Chat('UserA', '4234');Add a message to the chat box interface
Kind: instance method of Chat
| Param | Type | Description |
|---|---|---|
| username | String |
The user name to display |
| content | String |
The content of the message to display |
| [userTag] | String |
The user tag (display's next to the name in brackets) |
Example
chat.addMessage('UserB', 'Hello world back!', '1241');
add a chat prompt
Kind: instance method of Chat
| Param | Type | Description |
|---|---|---|
| sendMessage | function |
Callback with a Message object as argument |
Example
// add a prompt and do nothing on enter
chat.addPrompt(() => {});
// add a prompt and `console.log` data on enter
chat.addPrompt((msg) => {
console.log(msg);
// on enter event
})
Add a footer (Text at the bottom of the screen
Kind: instance method of Chat
| Param | Type | Description |
|---|---|---|
| content | String |
The text writtern in the footer |
Example
chat.addFooter('Press ESC-q to quit!');