MessageDraft object
MessageDraft represents a message that has not been published yet.
MessageDraft has the following properties:
1class MessageDraft {
2 channel: Channel,
3 value: string,
4 quotedMessage?: Message,
5 config: MessageDraftConfig,
6 files?: FileList | File[] | SendFileParameters["file"][];
7}
| Parameter | Description |
|---|---|
channelType: Channel | The channel the draft message is being created on. |
valueType: string | Message that includes mentions. |
quotedMessageType: Message or undefined | Object added to a draft message when you quote another message. |
configType: MessageDraftConfig | Configuration of the message containing mentions - what is the user source (channel members or app's keyset users), whether the typing indicator is enabled, and what is the maximum number of user names mentioned in one message (the default value is 10 and max is 100). |
filesType: FileList or File[] or SendFileParameters["file"][], or undefined | One or multiple files attached to the draft text message. They can take the form of a read-only files property of the HTML <input /> element (when a user has selected one or more files from their device), or through a drag-and-drop operation (FileList). Alternatively, that can be an array of file objects (File[]) or PubNub-specific `SendFileParameters["file"][]. |
Methods
Available methods:
addChangeListener()addLinkedText()addMention()addQuote()getMessagePreview()insertSuggestedMention()insertText()removeChangeListener()removeLinkedText()removeMention()removeQuote()removeText()send()update()
Use case
MessageDraft methods enable users to prepare draft messages with:
- Links
- User mentions with
@ - Channel references with
#