Type Alias: ChatCallbacks
ChatCallbacks =
object
Defined in: chat.ts:78
Optional callbacks fired after a chat changes.
Remarks
Callbacks run after the state change they describe, and a callback that throws
is reported without corrupting the transcript. Chat callbacks fire before the
ones registered on defineMessenger().
Properties
onChoice()?
optionalonChoice: (event) =>void
Defined in: chat.ts:99
Fires after the player's reply has been logged.
Parameters
event
chat
choiceId
string
index
number
option
Returns
void
onParticipantChange()?
optionalonParticipantChange: (event) =>void
Defined in: chat.ts:113
Fires when a group's membership changes.
Parameters
event
added?
string
chat
participants
string[]
removed?
string
Returns
void
onScriptEnd()?
optionalonScriptEnd: (event) =>void
Defined in: chat.ts:110
Fires when a script runs out of beats.
Parameters
event
chat
scriptId
string
Returns
void
onSeen()?
optionalonSeen: (event) =>void
Defined in: chat.ts:96
Fires when entries transition to seen, with the entries that changed.
Parameters
event
chat
entries
Returns
void
onSend()?
optionalonSend: (event) =>void
Defined in: chat.ts:93
Fires for every entry appended to the transcript - from a contact, from the player, and for system notices alike.
Parameters
event
chat
entry
Returns
void
Example
defineChat('anna', {
peer: anna,
onSend: ({ entry }) => {
if (entry.from !== 'player') notificationSound.play();
},
});
onTyping()?
optionalonTyping: (event) =>void
Defined in: chat.ts:107
Fires when the set of typing contacts changes.
Parameters
event
chat
typing
string[]
Returns
void